5

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

1 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.