Use JSON.stringify but the data still have array, what does it mean? -


i have data object array. contains object arrays in tree structure. use json.stringify(myarray) data still contain array because see [] inside converted data.

in case, want data converted json object not array regarding need used data on treetable of sapui5.

maybe misunderstand. please me clear.

this example of data got json.stringify.

[{"value":{"id":"00145e5bb2641ee284f811a7907717a3", "text":"bi-ra                   reporting, analysis, , dashboards", "parent":"00145e5bb2641ee284f811a79076f7a3","type":"bmf"}, "children":[{"value":{"id":"00145e5bb2641ee284f811a7907737a3", "text":"webintelligence_4.1","parent":"00145e5bb2641ee284f811a7907717a3", "type":"twb"},"children":[{"value":{"id":"00145e5bb2641ee284f811a7907757a3", "text":"functional areas","parent":"00145e5bb2641ee284f811a7907737a3","type":"twb"}, "children":[{"value":{"id":"00145e5bb2641ee284f811a7907777a3", "text":"charting","parent":"00145e5bb2641ee284f811a7907757a3","type":"twb"}, "children":[{"value":{"id":"001999e0b9081ee28ab706be26631e93", "text":"drill","parent":"00145e5bb2641ee284f811a7907777a3","type":"twb"}, "children":[{"value":{"id":"001999e0b9081ee28ab706be26633e93", "text":"[auto][accept] drill on charts dhtml","parent":"001999e0b9081ee28ab706be26631e93", "type":"twb","ref":"ut_webi_charts_drill_html"}},{"value":{"id":"001999e0b9081ee28ab706be26635e93", "text":"[auto][accept] drill on charts java","parent":"001999e0b9081ee28ab706be26631e93", "type":"twb","ref":"ut_webi_charts_drill_java"}}]},... 

the output want shouldn't array of object should like...

   {{"value":{         "id":"00145e5bb2641ee284f811a7907717a3",         "text":"bi-ra                   reporting, analysis, , dashboards",         "parent":"00145e5bb2641ee284f811a79076f7a3","type":"bmf"},         "children":{            {"value":{                 "id":"00145e5bb2641ee284f811a7907737a3",                 "text":"webintelligence_4.1",                 "parent":"00145e5bb2641ee284f811a7907717a3",                 "type":"twb"},                 "children":{                       {"value":{                           "id":"00145e5bb2641ee284f811a7907757a3",                           "text":"functional areas",                           "parent":"00145e5bb2641ee284f811a7907737a3",                           "type":"twb"},... 

json.stringify merely converts javascript data structures json-formatted string consumption other parsers (including json.parse). if want stringify different value, must change source data structures first.

however, seems can't represented other array because have duplicate keys (i.e. value appears more once). not valid javascript object or json representation of such.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -