javascript - Cannot get two objects united with Json.parse and Json.stringify -
i have doubt how unite objects , give them in express response in node js.
the object this:
{ "idp": 1, "pasaportenum": 787643682, "fidp": 1, "fid_p": 1 }
the other 1 also:
{ "idp": 1, "pasaportenum": 827348, "fidp": 1, "fid_p": 75683475 }
so code like:
var = json.stringify(context.instance[0].datavalues) var b = json.stringify(context.instance[2].datavalues) res.send('{'+json.parse(a+','+b)+'}')
why receive error?
"unexpected token , in json @ position 53"
at end need like:
{ "idp": 1, "pasaportenum": 787643682, "fidp": 1, "fid_p": 1 }, { "idp": 4, "pasaportenum": 456789, "fidp": 2, "fid_p": 2 }
regards
seeing have 2 objects same properties, want add array before stringifying
var arr = [context.instance[0].datavalues, context.instance[2].datavalues] res.send( json.stringify( arr ) )
Comments
Post a Comment