거래 로봇을 무료로 다운로드 하는 법을 시청해보세요
당사를 Facebook에서 찾아주십시오!
당사 팬 페이지에 가입하십시오
스크립트가 흥미로우신가요?
그렇다면 링크 to it -
하셔서 다른 이들이 평가할 수 있도록 해보세요
스크립트가 마음에 드시나요? MetaTrader 5 터미널에서 시도해보십시오
라이브러리

JSON Serialization and Deserialization (native MQL) - MetaTrader 5용 라이브러리

조회수:
33056
평가:
(86)
게시됨:
2015.10.12 14:47
업데이트됨:
2018.01.08 15:27
\MQL5\Scripts\ \MQL5\Include\
JAson.mqh (30.59 KB) 조회
MQL5 프리랜스 이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

Serialization and deserialization of JSON protocol. The code is ported from a high-speed С++ library.

string in, out;
CJAVal js(NULL, jtUNDEF); bool b;

//---
Print("JASon Example Deserialization:");

in="{\"a\":[1,2]}"; out=""; // example of input data
b=js.Deserialize(in); // deserialized
js.Serialize(out); // serialized again
Print(in+" -> "+out); // output for comparison

//---
Print("JASon Example Serialization:");

js["Test"]=1.4; // input data example
out=""; js.Serialize(out); // serialized
Print(out); // output


Practical example: authorization on a website and parsing the response

CJAVal jv;
jv["login"]="Login"; // login
jv["password"]="Pass"; // password

//--- serialize to string  {"login":"Login","password":"Pass"}
char data[]; 
ArrayResize(data, StringToCharArray(jv.Serialize(), data, 0, WHOLE_ARRAY)-1);

//--- send data
char res_data[];
string res_headers=NULL;
int r=WebRequest("POST", "http://my.site.com/Authorize", "Content-Type: text/plain\r\n", 5000, data, res_data, res_headers);

//--- assume the answer {"accessToken":"ABRAKADABRA","session_id":124521}
//--- get AccessToken
jv.Deserialize(res_data);
string AccessToken=jv["accessToken"].ToStr();


You can show your gratitude by sending examples of implementing MQL for working with web resources. Share you experience with JSON in MQL.

MetaQuotes Ltd에서 러시아어로 번역함.
원본 코드: https://www.mql5.com/ru/code/13663

ForecastOscilator_HTF ForecastOscilator_HTF

The ForecastOscilator indicator with the timeframe selection option available in the input parameters.

Flat_HTF Flat_HTF

The Flat indicator with the timeframe selection option available in the input parameters.

FX5_SelfAdjustingRSI_HTF FX5_SelfAdjustingRSI_HTF

The FX5_SelfAdjustingRSI indicator with the timeframe selection option available in the input parameters.

FX5_SelfAdjustingCCI FX5_SelfAdjustingCCI

The CCI oscillator with the boundaries of the overbought/oversold areas in the form of Bollinger Bands.