Y
Y
Yuri Petrashevich2017-07-05 07:40:45
go
Yuri Petrashevich, 2017-07-05 07:40:45

How to parse multilevel json in GO?

there is a line {"data":{"id":7548,"name":"Ralph"}}
tell me how to get the value of data.name, i.e. "Ralph"
If json is single-level, then everything is obtained by creating a structure with two levels and no longer exits.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey K, 2017-07-05
@BelCoder

https://play.golang.org/p/7XBu5nEpJS
Alternatively, use https://github.com/tidwall/gjson

A
Alexander Aksentiev, 2017-07-05
@Sanasol

It is optional to use the structure
https://play.golang.org/p/PxaisvjMfM

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question