-1

I'm currently using the Newtonsoft.Json library in C#. I'm working with files that have multiple top-level items and for what I'm doing that's perfectly fine. However the library is marking every single one of those top-level items as an error and it's very annoying because it's pushes all the other warnings out.

Usually you can suppress warnings in the Build Properties but this warning doesn't have a code (CheckId) attached to it.

1

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
DeepQuantum
  • 273
  • 3
  • 14
  • Might you please [edit] your question to share you errors as **text** rather than as a screen shot? It's requested here not to to use images for this purpose, see [*Discourage screenshots of code and/or errors*](https://meta.stackoverflow.com/a/307500) and [*Why not upload images of code on SO when asking a question*](https://meta.stackoverflow.com/a/285557) for why. A [mcve] would be ideal. – dbc Sep 14 '20 at 21:25
  • To deserialize a file containing multiple JSON values concatenated together, set `SupportMultipleContent ` as shown in [Parsing large JSON file in .NET](https://stackoverflow.com/a/32237819/3744182) and [Line delimited json serializing and de-serializing](https://stackoverflow.com/a/29729419/3744182). To simply ignore the second and subsequent values, set `CheckAdditionalContent = false` as shown in [Discarding garbage characters after json object with Json.Net](https://stackoverflow.com/a/37173878/3744182). In fact your question may be a duplicate of those, agree? – dbc Sep 14 '20 at 21:28

1 Answers1

1

Those warnings are not coming from the library, they're coming from Visual Studio because you have a document editor open with an invalid JSON file. Multiple top-level items -- while perhaps fine for your application -- is not valid JSON so it's not surprising that you're getting warnings. You can turn off all JSON warnings in Tools -> Options -> Text Editor -> JSON -> Advanced -> Enable validation (set to False).

Jeff
  • 7,504
  • 3
  • 25
  • 34