0

Thats my json string or part of it: "/Date(1423232459000)/"

I do var date= $.parseJSON(item.createdAt);

but an error is thrown in the console: Uncaught SyntaxError: Unexpected token /

How can I fix that or read the date?

Pascal
  • 12,265
  • 25
  • 103
  • 195
  • 3
    Why the slashes? It's interpreted as a RegEx, and RegExes cannot be parsed in JSON. – Jeremy Thille Feb 06 '15 at 14:19
  • Slashes? Thats the way I get it from the sharepoint server. – Pascal Feb 06 '15 at 14:20
  • @Pascal,the response is not in a json format.Use regex to get the date string – user3040610 Feb 06 '15 at 14:22
  • 1
    What does the actual response back from the server look like? – epascarello Feb 06 '15 at 14:23
  • 1
    @Pascal check out [this answer](http://stackoverflow.com/a/2316066/2776550) – sabotero Feb 06 '15 at 14:23
  • Actually there's nothing inherently invalid about having that value in a JSON string. it is not "interpreted as a RegEx", it's parsed as a string (it has quotes around it after all). Are you sure this is the code causing the error? Here's your code in JSFiddle not causing any errors: http://jsfiddle.net/nfkwmaox/ – Andrew Whitaker Feb 06 '15 at 14:26
  • Thanks I used this answer: http://stackoverflow.com/questions/1244094/converting-json-results-to-a-date :-) – Pascal Feb 06 '15 at 14:26

0 Answers0