10

The JsonToken enum in Newtonsoft.Json namespace contains, among others, the entry JsonToken.StartConstructor.

I most likely misinterpret the meaning of this token, as I take it for granted that JS's constructor methods are not valid in JSON, the same as there are no function, expression, or var tokens.

So how would a constructor be manifested in JSON, if that's what it is?

Tar
  • 8,529
  • 9
  • 56
  • 127

1 Answers1

14

Looking at the ParseTests source code, it looks like it's so that you can have JSON like this:

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

... which isn't actually valid JSON, but may be common in the wild.

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
  • similar example is found in a link from stuartd: `{ "Constructor": new Date(2000, 12, 30) }`, but if I read well, that linked piece of code is actually a formatter that outputs such 'json' – quetzalcoatl Feb 10 '17 at 11:42