Parsing from a json string to a wrong object does not show any errors


#1

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)

#2

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?


#3

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")

#4

Where do you run your JS?
I get SyntaxError: Unexpected token i in JSON at position 2 in the Chrome.