Theren
Theren

Reputation: 393

Convert string to array or object

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!

Upvotes: 0

Views: 127

Answers (1)

CD..
CD..

Reputation: 74176

Like this:

JSON.parse('[' + '{"subject":"Test Comment"},{"message":"Test Message."}' + ']')

Upvotes: 2

Related Questions