Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why is JSON disregarding the escape?

JSON is disregarding the backslashes on line 3. I want whatever is between double quotes from line 3 to 18 as a string.

This is my JSON code:

{
    "schema":
    "syntax = \"proto3\";
    message SearchRequest {
        float eventVersion = 1;
        string producedBy = 2;
        string asupSubject = 3;
        int64 sysSerialNo = 4;
        int64 systemId = 5;
        string rawAsupPath = 6;
        int64 completedTimestamp = 7;
        string sourceQueue = 8;
        .SearchRequest.addonattributes addOnAttributes = 9;
  message addonattributes {
    string asupSecureType = 1;
    string sesgFlag = 2;
        }
    }",
  "schemaType": "PROTOBUF"
}

This is the output received:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

{
    "error_code": 400,
    "message": "Illegal unquoted character ((CTRL-CHAR, code 13)): has to be escaped using backslash to be included in string value\n at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 3, column: 27] (through reference chain: io.confluent.kafka.schemaregistry.client.rest.entities.requests.RegisterSchemaRequest[\"schema\"])"
}

>Solution :

Its actually the linebreaks that are breaking it. Try this:

{
    "schema":
    "syntax = \"proto3\";\n    message SearchRequest {\n        float eventVersion = 1;\n        string producedBy = 2;\n        string asupSubject = 3;\n        int64 sysSerialNo = 4;\n        int64 systemId = 5;\n        string rawAsupPath = 6;\n        int64 completedTimestamp = 7;\n        string sourceQueue = 8;\n        .SearchRequest.addonattributes addOnAttributes = 9;\n  message addonattributes {\n    string asupSecureType = 1;\n    string sesgFlag = 2;\n        }\n    }",
  "schemaType": "PROTOBUF"
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading