Unlocking the Secrets of JSON.stringify(): More Than Meets the Eye

JSON (JavaScript Object Notation) is a lightweight data-interchange format widely used in web development. At the core of working with JSON in JavaScript lies a handy function called JSON.stringify(). While most developers use this function for simple conversions, there’s more to JSON.stringify() than meets the eye. Let’s dive deeper into its advanced features and lesser-known capabilities.

Read More

HOW TO CONVERT FORMDATA TO JSON OBJECT

Recently, whilst working on a project I needed to take HTML FormData and then convert it to JSON to be sent off to an API. By default the FormData object does not work in the way you would want it to for JSON.

Using thefor..ofsyntax introduced in ECMAScript 2015, we can access the form data entries and iterate over them to get key and value pairs. This will be the verbose solution, scroll to the bottom to get the cleaner solution using.reducebelow.

Read More

Pin It on Pinterest