Javascript — How to merge 2 JSON strings together and return a string

Purpose

We will assume that we are starting from two JSON strings and, at the end, we want to obtain a single JSON string with the merged objects.

How to merge 2 JSON objects together

  1. We will start our code by defining two JSON strings containing two different objects. These are the objects we will merge.
const string1  = `{"name": "Todd",

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store