javascript - Node.js How To serialize colon separated key value pairs to JSON -


given (as post response body):

result: ok result_ps: finished result_code: 000 

i need serialize json, use node's request server. surely can parse string string.

  1. but isn't there easier way?
  2. maybe ready serializer or serialize such data json?
  3. what format this?

filter each line following code

var jsonobject = {}  function parser(str){ var arr = str.split(":"); jsonobject[arr[0]] = arr[1]; } 

your final jsonobject json needed.
make sure need pass result: ok, result_ps: finished,result_code: 000 seperate strings parser.


Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -