Hello, My goal is to send array json variable from velocity to javacript or more precisely I want loop over all objects of same Class of a page and put them in a json array (http://platform.xwiki.org/xwiki/bin/view/DevGuide/APIGuide#HAccessobjectsfromanypageandloopoverallobjectsofsameClass)
But I didn't manage to edit an velocity array variable (add an entries or modify one) AND With velocity I declare my array like this: #set ($MyArray={ 'Index1':{'Field1':'value1','field2':'value2'}, 'Index3':{'Field1':'A value','field2':'Another value'} }) How can I add an "Index2" entrie by example: 'Index2':{'Field1':'A new value','field2':'Another new value'}" and/or can how can I modify a value ('Index 1'.field2' by example)? I tried to generate arraw velocity variable from a string like this, but unfortunaly generate a unique ... string :-( Here my code: {{velocity}} #set ($MyArray={ 'Index1':{'Field1':'value1','field2':'value2'}, 'Index3':{'Field1':'A value','field2':'Another value'} }) $jsontool.serialize($MyArray) Correct json arraw but I can NOT edit it :-( {"Index1":{"Field1":"value1","field2":"value2"},"Index3":{"Field1":"A value","field2":"Another value"}} ---- #set ($MyArrayString="{") #set ($MyArrayString=$MyArrayString +"'Index1':{'Field1':'value1','field2':'value2'},") #set ($MyArrayString=$MyArrayString +"'Index3':{'Field1':'A value','field2':'Another value'}") #set ($MyArrayString=$MyArrayString +"}") $jsontool.serialize($MyArrayString) I can edit this json arraw but it as wrong json arraw because the "" characters :-( "{'Index1':{'Field1':'value1','field2':'value2'},'Index3':{'Field1':'A value','field2':'Another value'}}" {{/velocity}} Thxs for any help Pascal b _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users