Help with complex json

 

Goodnight.

I'm trying to use the library available in the codebase, JSON Serialization and Deserialization (native MQL) - library for MetaTrader 5, but I'm not getting it.

I need to get the "BUYER name" (NAME I WANT TO GET)  and I'm trying to use the following command:

DadosJson[ "items" ][ "users" ][ "user" ][ "name" ].ToStr ();


But I'm not having success. I believe that this "role" is what is bothering me, but I have studied since yesterday without being able to evolve.


Thanks in advance if anyone can help me.


Below is the text I have in json:


{
"page_info": {
"results_per_page": 1,
"total_results": 1
},
"items": [
{
"code": "WT001",
"type": {
"name": "Prod1",
"id": 2056378
},
"users": [
{
"role": "EXCHANGE",
"user": {
"trade_name": "White Trader ",
"site": "whitetrader.com.br",
"name": "Ricardo Almeida Branco",
"locale": "PT_BR",
"address": {
"country": "Brasil",
"zip_code": "823",
"number": "227",
"state": "PR",
"city": "Curitiba"
}
}
},
{
"role": "BUYER",
"user": {
"documents": [
{
"type": "DOCUMENT",
"value": "0002"
}
],
"ucode": "8a",
"name": "NAME I WANT TO GET",
"locale": "PT_BR",
"address": {
"country": "Brasil"
}
}
},
{
"role": "BUYER2",
"user": {
"name": "Name 2",
"documents": [
{
"type": "CPF",
"value": "0003"
}
],
"ucode": "caa ",
"locale": "PT_BR",
"address": {
"country": "Brasil"
}
}
}
]
}
]
}


Tks!

JSON Serialization and Deserialization (native MQL)
JSON Serialization and Deserialization (native MQL)
  • www.mql5.com
Serialization and deserialization of JSON protocol. The code is ported from a high-speed С++ library.
Reason: