PDA

View Full Version : paticualr string



mouni
21st November 2016, 06:53
QString str = "{“result”:0,“command”: “frontend_get_info”,“commandIdâ €:0,“bitErrorRate”:0,“noiseR atio”:28,“error”: “xxx”,“lockStatus”: “lock”}";

i want to get only value 28 from string ....

how can i get plz give some solution with code

Lesiok
21st November 2016, 07:06
This looks like JSON so use appropriate API.

mouni
21st November 2016, 07:07
yes it is json response

Ginsengelf
21st November 2016, 07:58
Hi, you can use QString::split to split the string at the comma, the iterate over the resulting QStringList and check for the key you are looking for, e.g. “noiseRatio”.
Although a real JSON API would probably be easier to use and more versatile.

Ginsengelf