3

I have started the upgrade of my project from ASP.net core 2.1 to 3.1, but having an issue with reading the appsettings.json file. This file has not changed and I am getting the following error:

JsonReaderException: '0x0D' is invalid within a JSON string. The string should be correctly escaped. LineNumber: 2 | BytePositionInLine: 64

When string value is in 1 line it works fine. Example:

 "SELECT * FROM TabelName " 

But when I add any line break it gives above error. Example:

 "SELECT * 
FROM 
TabelName " 

PS: It was working fine in .net core 2.0

Faisal
  • 45
  • 1
  • 8

1 Answers1

2

I think0x0D is the Carriage Return character (\r). I've had a similar problem where I had a path that contained backslashes where the backslashes were interpreted as escaped characters (see my answer to a different question on that here).

I don't know how to put multi-line strings in your file but knowing why it fails could possibly help you in your debugging.

I would've kept that statement on a single line.

Johan Gov
  • 1,262
  • 1
  • 13
  • 26