<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><br><div>I checked the implementation code of JsonPart, the “parts” part uses Array, the “List” part uses Map, so there will be duplicate values in the “parts” part, and the duplicate keys of the "List" part will be overwritten. .</div><div><br></div><div> JSONArray keys = new JSONArray();</div><div> JSONObject output = new JSONObject();</div><div><br></div><div> For (CmsJsonPart part : parts) {</div><div> If (output.has(part.getKey())) {</div><div> LOG.warn("Duplicate key for JSON parts: " + part.getKey());</div><div> }</div><div> Keys.put(part.getKey());</div><div> Output.put(part.getKey(), part.getValue());</div><div> }</div><div> Output.put(KEY_PARTS, keys);</div><div><br></div><div>Maybe this is a bug, you can go to an issue. .</div><br><br><br><div style="position:relative;zoom:1">--<br><div><br></div>
<div>缘起法实不可思议也。</div>
<div style="clear:both"></div></div><div id="divNeteaseMailCard"></div><br>在 2019-02-13 13:41:55,"Андрей Диканский" <andikk@mail.ru> 写道:<br> <blockquote id="isReplyContent" style="padding-left: 1ex; margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); --darkreader-inline-border-left:#3d3d3d;" data-darkreader-inline-border-left="">I tried it. I still have "wrong" JSON output:<br><br><pre style="overflow-wrap: break-word; white-space: pre-wrap;" data-mce-style="overflow-wrap: break-word; white-space: pre-wrap;">{"parts":["Title","Title","Title"],"Title":"Title 1"}</pre><br>It seems that <span style="font-family: Arial; font-size: 14px;" data-mce-style="font-family: Arial; font-size: 14px;"><cms:jsonpart> takes only the last one content element for output.</span><br><br><br><blockquote style="border-left: 1px solid rgb(8, 87, 166); margin: 10px; padding: 0px 0px 0px 10px; --darkreader-inline-border-left:#0a6cce;" data-darkreader-inline-border-left="">
Среда, 13 февраля 2019, 9:31 +03:00 от 脸谱 <afeinet@163.com>:<br>
<br>
<div id="">
<div class="js-helper js-readmsg-msg">
<style type="text/css"></style>
<div>
<div id="style_15500394640000000024_BODY"><div class="class_1550048857"><div style="line-height: 1.7; color: rgb(0, 0, 0); font-size: 14px; font-family: Arial; --darkreader-inline-color:#e8e7e3;" data-darkreader-inline-color=""><div><div>Hi, I have not used the jsonpart tag, but I suggest you use the following code to try to see what the output is.</div><div><br></div></div><div><cms:contentload collector="allInFolder" param="/service/1/Direction-%(number).xml|Direction" preload="true"><br></div><div> <cms:contentinfo var="info" /></div><div> <c:if test="${info.resultSize > 0}"></div><div> <cms:contentload></div> <%-- This is itself a loop call. It is not sure which part is decided. --%><div> <cms:contentaccess var="content" /> <%-- This content will change with the loop, so it might be yours Direction1.xml, Direction2.xml, Direction3.xml . . . --%></div><div> <cms:jsonpart element="Title"> ${content.value.Title} </cms:jsonpart></div><div> </cms:contentload></div><div> </c:if></div><div> </cms:contentload> </div><div><br></div><div><br></div><div><br></div><style style="display:none">.class_1550048857 p{
margin-top:0px;
margin-bottom:0px;
}</style></div><br><br><span title="neteasefooter"><p> </p></span></div></div>
<div>_______________________________________________<br>
This mail is sent to you from the opencms-dev mailing list<br>
To change your list options, or to unsubscribe from the list, please visit<br>
<a href="http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev" target="_blank">http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev</a><br>
<br>
<br>
<br>
</div>
</div>
</div>
</div>
</blockquote>
<br>
<br>-- <br>Andrew Dikansky<br>
</blockquote></div><br><br><span title="neteasefooter"><p> </p></span>