J
J
Janny2017-05-28 22:38:01
JSON
Janny, 2017-05-28 22:38:01

Why did JSON.parse stop working in Node?

game = JSON.parse(response.body);
in response.body

{"id":"2","winner_id":null,"status":"1","items":"0","price":"1820","started_at":"2017-05-28 14:57:03","finished_at":"0000-00-00 00:00:00","chance":"0.0","won_items":"NULL","comission":"0","status_prize":"0","rand_number":"0.111892123403201914","created_at":"2017-05-28 13:33:12","updated_at":"2017-05-28 14:57:03","winner":null}

JSON.parse is not executed, all code that is written after is not executed. If directly inserted
{"id":"2","winner_id":null,"status":"1","items":"0","price":"1820","started_at":"2017-05-28 14:57:03","finished_at":"0000-00-00 00:00:00","chance":"0.0","won_items":"NULL","comission":"0","status_prize":"0","rand_number":"0.111892123403201914","created_at":"2017-05-28 13:33:12","updated_at":"2017-05-28 14:57:03","winner":null}
, then the code is executed. What is the reason?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly, 2017-05-28
@Genuas

Maybe because response.body is a js object and doesn't need to be parsed?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question