Most memory efficient way to re format a JSON array in Java -
say have json array similar following:
[ { "title": "this title", "year": 2013, "images": { "image": "http://........jpg", }, "ratings": { "thumbsup": 1053, "thumbsdown": 256 } }, { "title": "this title", "year": 2013, "images": { "image": "http://........jpg", }, "ratings": { "thumbsup": 1053, "thumbsdown": 256 } } ]
and required output json array this:
[ { "title": "this title", "images": { "image": "http://........jpg", }, "ratings": { "thumbsup": 1053, } }, { "title": "this title", "images": { "image": "http://........jpg", }, "ratings": { "thumbsup": 1053, } } ]
iv'e been researching , it's suggested efficient way parse using jackson streaming api. use on paas limited memory, wish keep memory usage bare minimum.
is best way parse json jackson streaming api, , construct new json array @ same time or remove elements somehow?
i did similiar xml once. can have requestor tell fields want back, , have emit those. in case had no control on 3rd party axis xml view, once had view, when asked things if there give pieces interested in. bonus, if marshalling or unmarshalling real java objects json after getting json or xml don't need build part of object graph don't care about.
Comments
Post a Comment