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.
- but isn't there easier way?
- maybe ready serializer or serialize such data json?
- 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
Post a Comment