WeAreDevelopers LIVE • Oct 18, 2024

Tips and Tricks for Working with JSON

Dan Cranney

Stop crashing your Node apps with malformed JSON. Master ten advanced techniques to safely parse, sanitize, and deep clone your data effortlessly.

Pause
Mute Enter Fullscreen
#1 about 2 min

Gracefully handling invalid formatted JSON data

Using a try-catch block during file reading prevents applications from crashing on malformed syntax.

#2 about 1 min

Implementing a simple JSON validation function

Wrapping the parsing method in a reusable function cleanly returns a boolean status for validity checks.

#3 about 1 min

Formatting stringified output for better readability

Passing spacing arguments into stringify operations adds structured indentation for easier visual inspection.

#4 about 2 min

Filtering specific fields with a replacer function

Supplying a replacer parameter during stringification efficiently excludes sensitive keys like passwords or emails.

#5 about 1 min

Transforming parsed data using a reviver function

Applying a reviver function to parsing intercepts specific keys to cast string values into appropriate formats like date objects.

#6 about 1 min

Deep cloning objects to prevent mutating original data

Serializing and immediately deserializing data creates completely independent object copies to safely manipulate values.

#7 about 1 min

Converting JSON object properties into query strings

Mapping over object keys and encoding values enables the construction of valid URL query parameters.

#8 about 1 min

Generating dynamic objects from independent array lists

Iterating over parallel lists of keys and values programmatically constructs complete and matching data structures.

#9 about 1 min

Shallow merging multiple objects via spread operators

Destructuring existing structures into a new object efficiently applies partial updates and overwrites duplicate keys.

#10 about 2 min

Extracting nested data collections directly with flatMap

Invoking flatMap immediately retrieves and naturally flattens internal lists from complex nested hierarchies.

Matching moments

2:32 min

Dealing with mixed payloads and structural patterns

Olena Kutsenko · World Congress 2022

1:28 min

Optimizing performance across JSON methodologies and backend stacks

Alen Pokos · LIVE

3:18 min

Leveraging the JSON API standard for data structure

Alen Pokos · LIVE

2:04 min

Optimizing JSON tool outputs with structural data heuristics

Devanshi Vyas Devanshi Vyas · World Congress 2026 North America

2:37 min

Handling complex data structures with records and pattern matching

Christoph Christoph · World Congress 2024

1:56 min

Serializing objects with the structured clone algorithm

Matteo Collina Matteo Collina · World Congress 2025

Upcoming sessions on this topic

Open session

From Profiler to Production: Measuring What Actually Matters in React & React Native

  • Andrei Tazetdinov

    Dynatrace

    React Native Developer

Open session

React Under Fire: Rendering Performance for Streaming Agent UIs

  • Abhirupa Mitra

    Slack

    Senior Member of Technical Staff

Open session

Teaching AI Coding Agents to Build It Right the First Time

  • Sajeetharan Sinnathurai

    Microsoft

    Principal Product Manager

Open session

How We Cut Our API's p99 Latency from Minutes to Under a Second

  • Deepak Agrawal

    Atlassian

    Principal Software Engineer

Open session

Supply Chain Security for the Everyday Engineer

  • Pradumna Saraf

    Kestra Technologies

    Quality Assurance Engineer

Open session

Build a Zero-Cost AI Agent in Your Browser

  • Aishwarya Mathuria

    Adobe

    Computer Scientist

  • Nishant Thakur

    Adobe

    Senior Computer Scientist