I
I
Iliana2020-06-03 14:23:10
AJAX
Iliana, 2020-06-03 14:23:10

How to parse JSON correctly?

For a response like {"service": quantity,"service": quantity}
I used the following code:

$.each(new_data, function (key, value){
            $('#first').find('span#'+key).text(value + ' шт');
        });

Now I don’t understand how to write a response like
{"Country":{"Service":{"cost":Cost,"count":Quantity}}} displayed correctly:( tell me please, I understand js very poorly

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
ninja op op, 2020-06-03
@kur4chyt

$.parseJSON(json)

S
Stalker_RED, 2020-06-03
@Stalker_RED

JSON.parse()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question