46 lines
1.7 KiB
MQL5
46 lines
1.7 KiB
MQL5
//+------------------------------------------------------------------+
|
|
//| Files.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,10],[20,20]],\"comida\":\"holaaaaaaaaaaaaaa\\\\a\\\\a\\\\a\",\"trapo\":10.05,\"a\":true,\"invalid\":null}";
|
|
TSN::CJsonParser parser;
|
|
parser.Assing(json);
|
|
parser.CorrectPadding();
|
|
parser.Parse();
|
|
|
|
// Guardamos completo
|
|
parser.SaveCompiled("JsonParserByLeo\\jsontest.jsontc", true);
|
|
|
|
|
|
//---
|
|
long tape1[];
|
|
ArrayCopy(tape1, parser.m_cinta, 0, 0, parser.m_cinta_pos);
|
|
|
|
//---
|
|
parser.AssingFile("JsonParserByLeo\\jsontest.jsontc", true);
|
|
|
|
//---
|
|
long tape2[];
|
|
ArrayCopy(tape2, parser.m_cinta, 0, 0, parser.m_cinta_pos);
|
|
|
|
//---
|
|
PrintFormat("Es igaul = %s", (ArrayCompare(tape1, tape2) == 0 ? "si" : "no"));
|
|
}
|
|
//+------------------------------------------------------------------+
|