c# - how to access one name value pair from a JSON object -


let's have json object passed server via

javascriptserializer oser = new javascriptserializer(); string sjson = oser.serialize(myobject); 

the json returned client via ajax call is

"{\"isvalid\":false,\"employeeid\":null,\"fullname\":\"a\",\"emailaddress\":\"n/a\",\"phonenumber\":\"n/a\"}" 

so after $.parsejson(result);

is possible retrieve isvalid value without looping through whole object name/value pairs?

update: seems when json gets client : gets changed = between name value pairs. have figure out how replace = : can parse , access true object property notation.

success: function (data)                     {                         data.replace("=", ":");                     } 

doesn't work.

also have ajax datatype property set 'json'

you don't have loop through each field anyway - access direct property of result parsejson.

var obj = $.parsejson(result); alert(obj.isvalid); 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -