javascript - check null object in jquery each function -


I want a loop through every key value of the json element and printing it. But some keys are also null values.

Therefore $ Each is giving error TypeError: obj is empty

I do not want to remove an empty key from the object and the non object is html variable Do not want to print in I type the empty object to $ Each function

Fiddle Demo - & gt; I want to look in "", "Authenticator": "{\" EmailAddress \ ":" TCS "," ID ":" 23 "," Type ":" Payment "," AccountNo ":" 1234567890 " Dfgsdfgsdfg \ ", \" MobileNumber \ ", \" UniqueID \ ": \" 9876-8975657-6 \ "}," AddBill ": Null," PARTNERID ": Null," sHORTNAME ": Null," token ":" 8FB91DE6 "}; Var html; . $ ('Div') HTML (getKeyValueJson); Function getKeyValueJson {$ .each (obj, function, key)} {if (typeof value == 'object') {getKeyValueJson (value);} else {html + = '

zero of type return "object ", therefore the value is considered as the null value.

Since it seems that you want to completely eliminate the taps, you can clearly test the null values ​​when it starts. Your $ Each callback:

  $ Each (obj, function (key, value) {if (value === null) {return;} // Skull nulls ...    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -