What is the purpose of the Newtonsoft.Json.JsonToken.StartConstructor token?

JsonToken enum in Newtonsoft.Json namespace contains, among other things, a JsonToken.StartConstructor entry.

I most likely misinterpreted the meaning of this token, as I take it for granted that the JS constructor methods are not valid in JSON, just like the tex function , expression or var .

So, how would a constructor manifest itself in JSON if that were?

+5
source share
1 answer

Looking at the ParseTests source code , it looks like you can use JSON as follows:

 { "date": new Date(2017, 2, 10) } 

... which is not actually valid JSON, but can be distributed in the wild.

+9
source

Source: https://habr.com/ru/post/1264071/


All Articles