JsonParserByLeo/Test/Test.mq5

41 lines
1.5 KiB
MQL5
Raw Permalink Normal View History

2026-06-03 07:50:45 -05:00
//+------------------------------------------------------------------+
//| Test.mq5 |
//| Copyright 2026, Niquel Mendoza. |
//| https://www.mql5.com/ |
//+------------------------------------------------------------------+
#property copyright "Copyright 2026, Niquel Mendoza."
#property link "https://www.mql5.com/"
#property version "1.00"
#property strict
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
#include "..\\Src\\JsonNode.mqh"
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//---
string json = "{\"ae\":10,\"comida\":\"hola\",\"trapo\":10.05,\"a\":true,\"invalid\":null}";
//Print(json);
//---
TSN::CJsonParser parser;
parser.Parse(json);
Print(parser.InternalParse());
//Print(EnumToString(parser.LastErr()));
//parser.PrintCintaTypes();
//---
TSN::CJsonNode root = parser.GetRoot();
TSN::CJsonIteratorObj it = root.BeginObj();
while(it.IsValid())
{
PrintFormat("\"%s\" : %s", it.Key(), it.Val().ToString());
it.Next();
}
}
//+------------------------------------------------------------------+