Answered by:
Reading a JSON format

Question
-
User-541003552 posted
Hi All,
I have a webservice that output in a json format as below. How can i read the individual items
{"TransID":"OPe0ffe09","ResponseCode":"00","Balance":null,"Message":"{\"FirstName\":\"KEE\",\"LastName\":\"EDWINS\",\"dob\":\"06/07/1969\",\"gender\":\"MALE\",\"accountnumb\":\"10-020000036-01\",\"branch\":\"KASOA\",\"idtype\":\"VOTERS ID CARD\",\"idnumber\":\"5829023661\",\"phonenumb\":\"233207202602\",\"atype\":\"CURRENT\",\"photo\":\"iVBORw0KGgoAAAANSlllUhEUgAAB7EAAAegCAYAAACvP6b2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\",\"signature\":\"iVBORw0KGgoAAAANSUhEUgAABooo7EAAAegCAYAAACvP6b2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\",\"biodata\":\"<biodata=EjkMvDgX09GMBn/>\"}"}
Thanks
Thursday, September 3, 2015 2:30 PM
Answers
-
User-1228306975 posted
var jso = {"TransID":"OPe0ffe09","ResponseCode":"00","Balance":null,"Message":"{\"FirstName\":\"KEE\",\"LastName\":\"EDWINS\",\"dob\":\"06/07/1969\",\"gender\":\"MALE\",\"accountnumb\":\"10-020000036-01\",\"branch\":\"KASOA\",\"idtype\":\"VOTERS ID CARD\",\"idnumber\":\"5829023661\",\"phonenumb\":\"233207202602\",\"atype\":\"CURRENT\",\"photo\":\"iVBORw0KGgoAAAANSlllUhEUgAAB7EAAAegCAYAAACvP6b2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\",\"signature\":\"iVBORw0KGgoAAAANSUhEUgAABooo7EAAAegCAYAAACvP6b2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\",\"biodata\":\"<biodata=EjkMvDgX09GMBn/>\"}"};
alert(jso.Message);
var msg = JSON.parse( jso.Message )
alert(msg.FirstName);- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, September 3, 2015 2:42 PM -
User753101303 posted
Hi,
Or if called using http://api.jquery.com/jQuery.ajax/ and the json dataType, you'll directly get a deserialized object inside the success function.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, September 3, 2015 2:49 PM -
User-434868552 posted
try using NuGet to get newtonsoft.json
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, September 3, 2015 6:11 PM
All replies
-
User-1228306975 posted
var jso = {"TransID":"OPe0ffe09","ResponseCode":"00","Balance":null,"Message":"{\"FirstName\":\"KEE\",\"LastName\":\"EDWINS\",\"dob\":\"06/07/1969\",\"gender\":\"MALE\",\"accountnumb\":\"10-020000036-01\",\"branch\":\"KASOA\",\"idtype\":\"VOTERS ID CARD\",\"idnumber\":\"5829023661\",\"phonenumb\":\"233207202602\",\"atype\":\"CURRENT\",\"photo\":\"iVBORw0KGgoAAAANSlllUhEUgAAB7EAAAegCAYAAACvP6b2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\",\"signature\":\"iVBORw0KGgoAAAANSUhEUgAABooo7EAAAegCAYAAACvP6b2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\",\"biodata\":\"<biodata=EjkMvDgX09GMBn/>\"}"};
alert(jso.Message);
var msg = JSON.parse( jso.Message )
alert(msg.FirstName);- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, September 3, 2015 2:42 PM -
User753101303 posted
Hi,
Or if called using http://api.jquery.com/jQuery.ajax/ and the json dataType, you'll directly get a deserialized object inside the success function.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, September 3, 2015 2:49 PM -
User-541003552 posted
Hi,
Thanks for your reply. But how do i get the assembly for json.
Am having the error that it does not exist .
Thanks
Thursday, September 3, 2015 3:33 PM -
User-434868552 posted
try using NuGet to get newtonsoft.json
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, September 3, 2015 6:11 PM