Json
Reduce a large JSON object down to only what you need
· Reading time: ~2 minute(s) (393 words) programming javascript json webSometimes you need to use an API that returns a large payload, but you may only need to use a small number of fields from that payload. Rather than try storing that data, or hand-balling the data yourself, there is an alternative solution.
In various other languages, such as C#, you can serialise and deserialise data and strip out what data you don’t want (by not declaring those properties in the models). This post explains how you can achieve the same thing in JavaScript with a little help from a pre-defined model, and some recursion:
(Continue reading)