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.

  1. open input file.
  2. read / parse json file using json library.
  3. convert in-memory data structure new structure.
  4. open output file
  5. 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

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -