java - Convert a JSON from one format to another? -
i have stream formatted in json, want transform format in order match application's input. example:
{ "id": "133880733349264", "feed": { "data": [ { "message": "message", "created_time": "2013-03-16t12:12:10+0000", "id": "133880733349264_477856435618357", "comments": { "data": [ { "message": "message", "id": "133880733349", } ] } }
needs be: {
"feed": { "identifier": "133880733349264" "message": "message", "created_time": "2013-03-16t12:12:10+0000", "id": "133880733349264_477856435618357", }, "comments": { "message": "message", "id": "133880733349", "message_id":"133880733349264" } }
any ideas or patterns on how use it?
it hardly rocket science.
- open input file.
- read / parse json file using json library.
- convert in-memory data structure new structure.
- open output file
- unparse in-memory data structure file using json library.
the details of conversion depend on application, , on nature of json library (or bindings) use. if want see available, visit http://www.json.org.
the other alternative use jslt engine ... that's "xslt json" more or less.
i found few google hits ... once convinced google really mean jslt not jstl. interestingly, questions mention jslt seem misspellings of jstl. (that rings warning bells me approach ...)
Comments
Post a Comment