not able to convert JSON string to javascript object -


    var jsonobj='[{"rmanumber":null,"orderreferencenumber":"referene45","orderstatus":"pending","daterequested":null,"dateapproved":null,"segateaddress":null,"billingaddress":null,"shippingaddress":null,"returnforcredit":{"requested":null,"received":null,"shipped":35,"credited":45,"invoiceamount":null},"returnforexchange":{"requested":null,"received":null,"shipped":35,"credited":45,"invoiceamount":null},"totals":null}]'     var parsedjson = eval('(\'+jsonobj+\')');         var result=parsedjson.result;     var count=parsedjson.count;     alert('result:'+result+' count:'+count); 

in alert giving undefined :undefined

1st thing :

var parsedjson = eval('(\'+jsonobj+\')'); 

should

var parsedjson = eval('('+jsonobj+')');    

2nd thing :
i don't see result or count object json string

3rd thing :
data in json in array, if object result there in objects, in array should accessed parsedjson[0].result


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -