0

I am trying to build a json that has 2 nodes, for example: "name":"david", and "id":"123123". So I am trying to do it with a new object with 2 nodes and then "stringify(obj)". I tried it in several ways but nothing is working for me. Any ideas?

1 Answer 1

1

Either:

const myObj = {
               name: "David", 
               id: "1"
           };

Or:

const myObj = {};
myObj.name = "David";
myObj.id = "1";

console.log(JSON.stringyfy(myObj);

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.