JsonParserByLeo/Test/Err.mq5
Nique_372 92e074d65d
2026-10-03 17:00:34 -05:00

66 lines
No EOL
2.2 KiB
MQL5

//+------------------------------------------------------------------+
//| Err.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()
{
//---
TSN::CJsonParser parser;
/*
//---
// Len has superated reading json, finding comma or context close (], }) [Line 1, Col 10]
parser.Assing("{\"a\":1.0");
parser.CorrectPadding();
parser.Parse();
parser.ErrorInfo();
//---
// A numeric value was expected after the decimal point. [Line 1, Col 9]
parser.Assing("{\"a\":1.}");
parser.CorrectPadding();
parser.Parse();
parser.ErrorInfo();
//---
// A number in JSON notation cannot have leading zeros. [Line 1, Col 8]
parser.Assing("{\"a\":007}");
parser.CorrectPadding();
parser.Parse();
parser.ErrorInfo();
//---
// Len has superated reading json, finding comma or context close (], }) [Line 2, Col 1]
parser.Assing("{\"a\":\"a}");
parser.CorrectPadding();
parser.Parse();
parser.ErrorInfo();*/
// 1000000000.000000001
parser.Assing("{");
parser.CorrectPadding();
parser.Parse();
parser.PrintCintaTypes(0, WHOLE_ARRAY);
parser.ErrorInfo();
//const double v = 0.65615514656343;
//Print(StringToDouble("0.65615514656343"));
// Print(parser.GetRoot()["a"].ToDouble(0.0)==StringToDouble("0.65615514656343"));
}
//+------------------------------------------------------------------+