0

I have below object.

{ Inputs : { key : value, key: valu }},

I want to convert it into json format JSON.stringify(Inputs) which is giving a format like below which is wrong and hence my code is failing.

"{"Inputs":{"key":"value","key":"value"}}"

I dont want double quote in the initial position. It shold be in below format so that my code will work.

{"Inputs":{"key":"value","key":"value"}}

Any help please. Thanks in advance.

2
  • JSON.stringify() returns a string. A string is enclosed in quotes. Commented May 28, 2020 at 9:27
  • @Andreas can you please help me how should I convert it. Thanks Commented May 28, 2020 at 9:29

1 Answer 1

1

If you don't want the double quotes at start and end, then you don't want a string but an object. For that, your initial object is OK, but if you need the strings you can try:

JSON.parse(JSON.stringify(yourObject))

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.