0

is there possible to convert this string to array or object? It is not a valid stringify JSON data, not sure how to tackle this.

"{"subject":"Test Comment"},{"message":"Test Message."}"

Thank in advance!

4
  • 7
    Although I'm sure you'll get answers on how to hack around it below, the best choice will always be to fix it at source - where it is generated Commented Apr 29, 2015 at 16:18
  • possible duplicate of Best way to convert string to array of object in javascript? Commented Apr 29, 2015 at 16:19
  • 1
    @Paul S. Actually, I am pulling out the data from a LMS service using the API provided which I can't go in and modify the source, what I can do is modify it once I get the data populated on my side. Commented Apr 30, 2015 at 6:11
  • @vjdhama I actually tried the solution on this thread before but it din't solve my problem though. Commented Apr 30, 2015 at 6:15

1 Answer 1

2

Like this:

JSON.parse('[' + '{"subject":"Test Comment"},{"message":"Test Message."}' + ']')
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.