Answer the question
In order to leave comments, you need to log in
How to parse JSON array in golang?
I get a very large JSON in resp.body. It has several fields and an array of order objects. The order object also has a lot of fields and, among others, there is an order_id field. I need to parse this JSON by pulling out a list of order_id. How can I do it?
Answer the question
In order to leave comments, you need to log in
The most efficient way would be to use this package:
https://github.com/tidwall/gjson
with the GetMany
.
There are also generators of structures like https://mholt.github.io/json-to-go/
We push an example of json there and get structures, write them in code and use them.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question