1

JSON String:

{
  "id":31896,

  "name":"Zickey attitude - McKinley,
   La Rosi\u00e8re,
   21 ao\u00fbt 2006",
...

}

this causes an unterminated string in JavaScript.

My attempt at a solution is:

data.replace(/(\S)\1(\1)+/g, '');

or

data.replace(/\\u([0-9A-Z])/, '');

any ideas/solution?

Example: http://api.jamendo.com/get2/id+name+url+stream+album_name+album_url+album_id+artist_id+artist_name/track/jsonpretty/track_album+album_artist/?n=13&order=ratingmonth_desc&tag_idstr=jazz

last node is the problem, fyi.

(/\\u([0-9A-Z])/, '\1');
0

2 Answers 2

1

Your problem is not the unicode escapes, but the unescaped newlines.

{
    "id":31896,
    "name":"Zickey attitude - McKinley,\nLa Rosi\u00e8re,\n21 ao\u00fbt 2006"
}
Sign up to request clarification or add additional context in comments.

1 Comment

how to solve it? i can not access a loop to select just the names and replace with \\n \\r what ever the newlines?
1

well, the error occures only when using jsonpretty :).

shame on me ;)

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.