hey guys as you told I solved the content part in the json is there anything wrong? Let it check please.
Looking good .
I'd suggest to also add the digits of the asset and the point size , it will help you in the future .
This is how you read it , assuming you saved it as "feed3.json"
#include "jason_with_search.mqh"voidOnStart(){
//Create Jason object
CJAVal loader;
//file int f=FileOpen("feed3.json",FILE_READ|FILE_BIN);
uchar bytes[];
if(f!=INVALID_HANDLE){
FileReadArray(f,bytes,0,FileSize(f));
FileClose(f);
}
string raw=CharArrayToString(bytes,0,ArraySize(bytes),CP_UTF8);
//fill loader with json string
loader.Deserialize(raw,CP_UTF8);
//now lets say you want to see how many items there are in there int items=ArraySize(loader.m_e);
Print("Has "+IntegerToString(items)+" items");
for(int i=0;i<items;i++){
//methodstring method=loader[i]["method"].ToStr();
//symbolstring symbol=loader[i]["content"]["Symbol"].ToStr();
//directionint direction=(int)loader[i]["content"]["Direction"].ToInt();
//pricedouble price=(double)loader[i]["content"]["Price"].ToDbl();
//volume double volume=(double)loader[i]["content"]["Volume"].ToDbl();
Print("Item("+IntegerToString(i)+")"+symbol+" [DIR:"+IntegerToString(direction)+"] @"+DoubleToString(price,8)+" Vol."+DoubleToString(volume,8));
}
}
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
hey guys as you told I solved the content part in the json is there anything wrong? Let it check please.
Looking good .
I'd suggest to also add the digits of the asset and the point size , it will help you in the future .
This is how you read it , assuming you saved it as "feed3.json"
hey guys as you told I solved the content part in the json is there anything wrong? Let it check please.
}, ]remove the extra comma, it is allowed only followed by another value.
Looking good .
I'd suggest to also add the digits of the asset and the point size , it will help you in the future .
This is how you read it , assuming you saved it as "feed3.json"
Thank you so much.
You helped me so much.
remove the extra comma, it is allowed only followed by another value.
thank you so much I fixed it.
He needs to understand to JSON format to start with, otherwise it's waste of time. I will let you continue if you like.
Thank you so much for your patience.
You helped me so much. appreciate
remove the extra comma, it is allowed only followed by another value.
Nice catch i missed that .
Thank you so much.
You helped me so much.
:)