when i try to parse an object with the wrong type the script simply stops without any error notification. is this a bug?
val shouldThrowAnError = JSON.parse<WrongObjec>(jsonString)
when i try to parse an object with the wrong type the script simply stops without any error notification. is this a bug?
val shouldThrowAnError = JSON.parse<WrongObjec>(jsonString)
How is WrongObjec
defined? RIght now compiler should not report anything there, but it can be improved. So, feel free to create an issue.
the script simply stops without any error notification
What did you mean?
then i call this line, i dont see the message “success” in the console and no error message telling me that the parsing failed
val shouldThrowAnError = JSON.parse<Person>("{ invalid json}")
println("success")
Where do you run your JS?
I get SyntaxError: Unexpected token i in JSON at position 2
in the Chrome.