Mc Samuel
How can I convert null entries in JSON data to a default value?
I haven't used annotations in JS yet... And for serialization are you using another library which isn't the JSON library or maybe the app requires a mandatory serialization to another format of sort
21 replies
How can I convert null entries in JSON data to a default value?
But since editing the whole data might take a longer time if you only use a portion of it in practice ... Then i guess you can keep a "defaults object" to use when it's time to render the object in need so your code ends up checking the nulls then replacing from the "defaults object" properties
21 replies
How can I convert null entries in JSON data to a default value?
Im assuming you want to null check when displaying data then keep the json data as is without affecting it, since you might want to use it somewhere else or just to keep it's original integrity
21 replies
How can I convert null entries in JSON data to a default value?
If you want it to be a non-null vallue when displaying you can use the null check i think.. Check this [link from Mozilla] (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing)
21 replies