Rapidjson giving validation success even when required field is missing
I was expecting rapidjson to give a validation error as my json file doesn't include one of the 'required' field mentioned in the schema. However, due to some reasons this doesn't happen.
dbconf.json(json file)
{
"MAX_CONNECTION_PER_HOST":20,
"QUEUE_IO_SIZE":10485,
"Garbage":50000
}
Here's the test code along with the schema.
#include "rapidjson/document.h"
#include "rapidjson/error/en.h"
#include "rapidjson/schema.h"
#include <rapidjson/stringbuffer.h>
#include<iostream>
#include<string>
#include<fstream>
using namespace std;
const char g_plJsonSchema="{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Schema",
"description": "JSON schema for validating Json file",
"type": "object",
"properties": {
"MAX_CONNECTION_PER_HOST": { "type": "number" },
"QUEUE_IO_SIZE": { "type": "number" },
"REQUEST_LOW_WATER_MARK": { "type": "number" },
"required": [
"MAX_CONNECTION_PER_HOST",
"QUEUE_IO_SIZE",
"REQUEST_LOW_WATER_MARK"
]
}
}";
int main()
{
rapidjson::Document l_peerAddSchemaDoc, l_peerAddDataDoc;
l_peerAddSchemaDoc.Parse(g_plJsonSchema);
if(l_peerAddSchemaDoc.HasParseError())
{
printf("JSON schema file is not a valid JSON filen");
return -1;
}
std::ifstream l_confDataIStream("dbconf.json");
std::string l_confDataIStreamStr((std::istreambuf_iterator<char>(l_confDataIStream)),(std::istreambuf_iterator<char>()));
l_peerAddDataDoc.Parse(l_confDataIStreamStr.c_str());
rapidjson::SchemaDocument l_schemaDocument(l_peerAddSchemaDoc);
rapidjson::SchemaValidator l_SchemaValidator(l_schemaDocument);
if(!l_peerAddDataDoc.Accept(l_SchemaValidator))
{
rapidjson::StringBuffer sb;
l_SchemaValidator.GetInvalidSchemaPointer().StringifyUriFragment(sb);
printf("Invalid schema: %sn", sb.GetString());
printf("Invalid keyword: %sn", l_SchemaValidator.GetInvalidSchemaKeyword());
sb.Clear();
l_SchemaValidator.GetInvalidDocumentPointer().StringifyUriFragment(sb);
printf("Invalid document: %sn", sb.GetString());
}
else
printf("nJson file validated with the given schema successfullyn");
return 0;
}
I get the following output
Json file validated with the given schema successfully
jsonschema rapidjson
add a comment |
I was expecting rapidjson to give a validation error as my json file doesn't include one of the 'required' field mentioned in the schema. However, due to some reasons this doesn't happen.
dbconf.json(json file)
{
"MAX_CONNECTION_PER_HOST":20,
"QUEUE_IO_SIZE":10485,
"Garbage":50000
}
Here's the test code along with the schema.
#include "rapidjson/document.h"
#include "rapidjson/error/en.h"
#include "rapidjson/schema.h"
#include <rapidjson/stringbuffer.h>
#include<iostream>
#include<string>
#include<fstream>
using namespace std;
const char g_plJsonSchema="{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Schema",
"description": "JSON schema for validating Json file",
"type": "object",
"properties": {
"MAX_CONNECTION_PER_HOST": { "type": "number" },
"QUEUE_IO_SIZE": { "type": "number" },
"REQUEST_LOW_WATER_MARK": { "type": "number" },
"required": [
"MAX_CONNECTION_PER_HOST",
"QUEUE_IO_SIZE",
"REQUEST_LOW_WATER_MARK"
]
}
}";
int main()
{
rapidjson::Document l_peerAddSchemaDoc, l_peerAddDataDoc;
l_peerAddSchemaDoc.Parse(g_plJsonSchema);
if(l_peerAddSchemaDoc.HasParseError())
{
printf("JSON schema file is not a valid JSON filen");
return -1;
}
std::ifstream l_confDataIStream("dbconf.json");
std::string l_confDataIStreamStr((std::istreambuf_iterator<char>(l_confDataIStream)),(std::istreambuf_iterator<char>()));
l_peerAddDataDoc.Parse(l_confDataIStreamStr.c_str());
rapidjson::SchemaDocument l_schemaDocument(l_peerAddSchemaDoc);
rapidjson::SchemaValidator l_SchemaValidator(l_schemaDocument);
if(!l_peerAddDataDoc.Accept(l_SchemaValidator))
{
rapidjson::StringBuffer sb;
l_SchemaValidator.GetInvalidSchemaPointer().StringifyUriFragment(sb);
printf("Invalid schema: %sn", sb.GetString());
printf("Invalid keyword: %sn", l_SchemaValidator.GetInvalidSchemaKeyword());
sb.Clear();
l_SchemaValidator.GetInvalidDocumentPointer().StringifyUriFragment(sb);
printf("Invalid document: %sn", sb.GetString());
}
else
printf("nJson file validated with the given schema successfullyn");
return 0;
}
I get the following output
Json file validated with the given schema successfully
jsonschema rapidjson
Thanks for your question. Would you be able to provide your JSON Schema and JSON instace outside of your code please? This allows us to check if there is an issue with the schema itself or not first. Thanks.
– Relequestual
Nov 21 '18 at 14:14
Json file is already outside the code. Just remove the backslash from g_plJsonSchema to get the schema.
– Vishal Sharma
Nov 21 '18 at 14:23
{"$schema": "json-schema.org/draft-04/schema#", "title": "Schema", "description": "JSON schema for validating Json file", "type": "object", "properties": { "MAX_CONNECTION_PER_HOST": { "type": "number" }, "QUEUE_IO_SIZE": { "type": "number" }, "REQUEST_LOW_WATER_MARK": { "type": "number" }, "required": [ "MAX_CONNECTION_PER_HOST", "QUEUE_IO_SIZE", "REQUEST_LOW_WATER_MARK"] } }
– Vishal Sharma
Nov 21 '18 at 14:23
1
I just hope I've not done any mistakes while removing backslashes.
– Vishal Sharma
Nov 21 '18 at 14:24
For future reference, it's better to edit your question to add code blocks rather than use comments, however, this was OK to work with =]
– Relequestual
Nov 21 '18 at 14:31
add a comment |
I was expecting rapidjson to give a validation error as my json file doesn't include one of the 'required' field mentioned in the schema. However, due to some reasons this doesn't happen.
dbconf.json(json file)
{
"MAX_CONNECTION_PER_HOST":20,
"QUEUE_IO_SIZE":10485,
"Garbage":50000
}
Here's the test code along with the schema.
#include "rapidjson/document.h"
#include "rapidjson/error/en.h"
#include "rapidjson/schema.h"
#include <rapidjson/stringbuffer.h>
#include<iostream>
#include<string>
#include<fstream>
using namespace std;
const char g_plJsonSchema="{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Schema",
"description": "JSON schema for validating Json file",
"type": "object",
"properties": {
"MAX_CONNECTION_PER_HOST": { "type": "number" },
"QUEUE_IO_SIZE": { "type": "number" },
"REQUEST_LOW_WATER_MARK": { "type": "number" },
"required": [
"MAX_CONNECTION_PER_HOST",
"QUEUE_IO_SIZE",
"REQUEST_LOW_WATER_MARK"
]
}
}";
int main()
{
rapidjson::Document l_peerAddSchemaDoc, l_peerAddDataDoc;
l_peerAddSchemaDoc.Parse(g_plJsonSchema);
if(l_peerAddSchemaDoc.HasParseError())
{
printf("JSON schema file is not a valid JSON filen");
return -1;
}
std::ifstream l_confDataIStream("dbconf.json");
std::string l_confDataIStreamStr((std::istreambuf_iterator<char>(l_confDataIStream)),(std::istreambuf_iterator<char>()));
l_peerAddDataDoc.Parse(l_confDataIStreamStr.c_str());
rapidjson::SchemaDocument l_schemaDocument(l_peerAddSchemaDoc);
rapidjson::SchemaValidator l_SchemaValidator(l_schemaDocument);
if(!l_peerAddDataDoc.Accept(l_SchemaValidator))
{
rapidjson::StringBuffer sb;
l_SchemaValidator.GetInvalidSchemaPointer().StringifyUriFragment(sb);
printf("Invalid schema: %sn", sb.GetString());
printf("Invalid keyword: %sn", l_SchemaValidator.GetInvalidSchemaKeyword());
sb.Clear();
l_SchemaValidator.GetInvalidDocumentPointer().StringifyUriFragment(sb);
printf("Invalid document: %sn", sb.GetString());
}
else
printf("nJson file validated with the given schema successfullyn");
return 0;
}
I get the following output
Json file validated with the given schema successfully
jsonschema rapidjson
I was expecting rapidjson to give a validation error as my json file doesn't include one of the 'required' field mentioned in the schema. However, due to some reasons this doesn't happen.
dbconf.json(json file)
{
"MAX_CONNECTION_PER_HOST":20,
"QUEUE_IO_SIZE":10485,
"Garbage":50000
}
Here's the test code along with the schema.
#include "rapidjson/document.h"
#include "rapidjson/error/en.h"
#include "rapidjson/schema.h"
#include <rapidjson/stringbuffer.h>
#include<iostream>
#include<string>
#include<fstream>
using namespace std;
const char g_plJsonSchema="{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Schema",
"description": "JSON schema for validating Json file",
"type": "object",
"properties": {
"MAX_CONNECTION_PER_HOST": { "type": "number" },
"QUEUE_IO_SIZE": { "type": "number" },
"REQUEST_LOW_WATER_MARK": { "type": "number" },
"required": [
"MAX_CONNECTION_PER_HOST",
"QUEUE_IO_SIZE",
"REQUEST_LOW_WATER_MARK"
]
}
}";
int main()
{
rapidjson::Document l_peerAddSchemaDoc, l_peerAddDataDoc;
l_peerAddSchemaDoc.Parse(g_plJsonSchema);
if(l_peerAddSchemaDoc.HasParseError())
{
printf("JSON schema file is not a valid JSON filen");
return -1;
}
std::ifstream l_confDataIStream("dbconf.json");
std::string l_confDataIStreamStr((std::istreambuf_iterator<char>(l_confDataIStream)),(std::istreambuf_iterator<char>()));
l_peerAddDataDoc.Parse(l_confDataIStreamStr.c_str());
rapidjson::SchemaDocument l_schemaDocument(l_peerAddSchemaDoc);
rapidjson::SchemaValidator l_SchemaValidator(l_schemaDocument);
if(!l_peerAddDataDoc.Accept(l_SchemaValidator))
{
rapidjson::StringBuffer sb;
l_SchemaValidator.GetInvalidSchemaPointer().StringifyUriFragment(sb);
printf("Invalid schema: %sn", sb.GetString());
printf("Invalid keyword: %sn", l_SchemaValidator.GetInvalidSchemaKeyword());
sb.Clear();
l_SchemaValidator.GetInvalidDocumentPointer().StringifyUriFragment(sb);
printf("Invalid document: %sn", sb.GetString());
}
else
printf("nJson file validated with the given schema successfullyn");
return 0;
}
I get the following output
Json file validated with the given schema successfully
jsonschema rapidjson
jsonschema rapidjson
asked Nov 21 '18 at 14:06
Vishal SharmaVishal Sharma
299424
299424
Thanks for your question. Would you be able to provide your JSON Schema and JSON instace outside of your code please? This allows us to check if there is an issue with the schema itself or not first. Thanks.
– Relequestual
Nov 21 '18 at 14:14
Json file is already outside the code. Just remove the backslash from g_plJsonSchema to get the schema.
– Vishal Sharma
Nov 21 '18 at 14:23
{"$schema": "json-schema.org/draft-04/schema#", "title": "Schema", "description": "JSON schema for validating Json file", "type": "object", "properties": { "MAX_CONNECTION_PER_HOST": { "type": "number" }, "QUEUE_IO_SIZE": { "type": "number" }, "REQUEST_LOW_WATER_MARK": { "type": "number" }, "required": [ "MAX_CONNECTION_PER_HOST", "QUEUE_IO_SIZE", "REQUEST_LOW_WATER_MARK"] } }
– Vishal Sharma
Nov 21 '18 at 14:23
1
I just hope I've not done any mistakes while removing backslashes.
– Vishal Sharma
Nov 21 '18 at 14:24
For future reference, it's better to edit your question to add code blocks rather than use comments, however, this was OK to work with =]
– Relequestual
Nov 21 '18 at 14:31
add a comment |
Thanks for your question. Would you be able to provide your JSON Schema and JSON instace outside of your code please? This allows us to check if there is an issue with the schema itself or not first. Thanks.
– Relequestual
Nov 21 '18 at 14:14
Json file is already outside the code. Just remove the backslash from g_plJsonSchema to get the schema.
– Vishal Sharma
Nov 21 '18 at 14:23
{"$schema": "json-schema.org/draft-04/schema#", "title": "Schema", "description": "JSON schema for validating Json file", "type": "object", "properties": { "MAX_CONNECTION_PER_HOST": { "type": "number" }, "QUEUE_IO_SIZE": { "type": "number" }, "REQUEST_LOW_WATER_MARK": { "type": "number" }, "required": [ "MAX_CONNECTION_PER_HOST", "QUEUE_IO_SIZE", "REQUEST_LOW_WATER_MARK"] } }
– Vishal Sharma
Nov 21 '18 at 14:23
1
I just hope I've not done any mistakes while removing backslashes.
– Vishal Sharma
Nov 21 '18 at 14:24
For future reference, it's better to edit your question to add code blocks rather than use comments, however, this was OK to work with =]
– Relequestual
Nov 21 '18 at 14:31
Thanks for your question. Would you be able to provide your JSON Schema and JSON instace outside of your code please? This allows us to check if there is an issue with the schema itself or not first. Thanks.
– Relequestual
Nov 21 '18 at 14:14
Thanks for your question. Would you be able to provide your JSON Schema and JSON instace outside of your code please? This allows us to check if there is an issue with the schema itself or not first. Thanks.
– Relequestual
Nov 21 '18 at 14:14
Json file is already outside the code. Just remove the backslash from g_plJsonSchema to get the schema.
– Vishal Sharma
Nov 21 '18 at 14:23
Json file is already outside the code. Just remove the backslash from g_plJsonSchema to get the schema.
– Vishal Sharma
Nov 21 '18 at 14:23
{"$schema": "json-schema.org/draft-04/schema#", "title": "Schema", "description": "JSON schema for validating Json file", "type": "object", "properties": { "MAX_CONNECTION_PER_HOST": { "type": "number" }, "QUEUE_IO_SIZE": { "type": "number" }, "REQUEST_LOW_WATER_MARK": { "type": "number" }, "required": [ "MAX_CONNECTION_PER_HOST", "QUEUE_IO_SIZE", "REQUEST_LOW_WATER_MARK"] } }
– Vishal Sharma
Nov 21 '18 at 14:23
{"$schema": "json-schema.org/draft-04/schema#", "title": "Schema", "description": "JSON schema for validating Json file", "type": "object", "properties": { "MAX_CONNECTION_PER_HOST": { "type": "number" }, "QUEUE_IO_SIZE": { "type": "number" }, "REQUEST_LOW_WATER_MARK": { "type": "number" }, "required": [ "MAX_CONNECTION_PER_HOST", "QUEUE_IO_SIZE", "REQUEST_LOW_WATER_MARK"] } }
– Vishal Sharma
Nov 21 '18 at 14:23
1
1
I just hope I've not done any mistakes while removing backslashes.
– Vishal Sharma
Nov 21 '18 at 14:24
I just hope I've not done any mistakes while removing backslashes.
– Vishal Sharma
Nov 21 '18 at 14:24
For future reference, it's better to edit your question to add code blocks rather than use comments, however, this was OK to work with =]
– Relequestual
Nov 21 '18 at 14:31
For future reference, it's better to edit your question to add code blocks rather than use comments, however, this was OK to work with =]
– Relequestual
Nov 21 '18 at 14:31
add a comment |
1 Answer
1
active
oldest
votes
Your issue here is required
should be at the root level, and not inside properties
. In fact, you currently have an invalid schema, as all values of keys inside properties
should be objects only.
{
"$schema": "json-schema.org/draft-04/schema#",
"title": "Schema",
"description": "JSON schema for validating Json file",
"type": "object",
"properties": {
"MAX_CONNECTION_PER_HOST": {
"type": "number"
},
"QUEUE_IO_SIZE": {
"type": "number"
},
"REQUEST_LOW_WATER_MARK": {
"type": "number"
}
},
"required": [
"MAX_CONNECTION_PER_HOST",
"QUEUE_IO_SIZE",
"REQUEST_LOW_WATER_MARK"
]
}
I validated the schema against the instance using https://www.jsonschemavalidator.net for testing.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53413872%2frapidjson-giving-validation-success-even-when-required-field-is-missing%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Your issue here is required
should be at the root level, and not inside properties
. In fact, you currently have an invalid schema, as all values of keys inside properties
should be objects only.
{
"$schema": "json-schema.org/draft-04/schema#",
"title": "Schema",
"description": "JSON schema for validating Json file",
"type": "object",
"properties": {
"MAX_CONNECTION_PER_HOST": {
"type": "number"
},
"QUEUE_IO_SIZE": {
"type": "number"
},
"REQUEST_LOW_WATER_MARK": {
"type": "number"
}
},
"required": [
"MAX_CONNECTION_PER_HOST",
"QUEUE_IO_SIZE",
"REQUEST_LOW_WATER_MARK"
]
}
I validated the schema against the instance using https://www.jsonschemavalidator.net for testing.
add a comment |
Your issue here is required
should be at the root level, and not inside properties
. In fact, you currently have an invalid schema, as all values of keys inside properties
should be objects only.
{
"$schema": "json-schema.org/draft-04/schema#",
"title": "Schema",
"description": "JSON schema for validating Json file",
"type": "object",
"properties": {
"MAX_CONNECTION_PER_HOST": {
"type": "number"
},
"QUEUE_IO_SIZE": {
"type": "number"
},
"REQUEST_LOW_WATER_MARK": {
"type": "number"
}
},
"required": [
"MAX_CONNECTION_PER_HOST",
"QUEUE_IO_SIZE",
"REQUEST_LOW_WATER_MARK"
]
}
I validated the schema against the instance using https://www.jsonschemavalidator.net for testing.
add a comment |
Your issue here is required
should be at the root level, and not inside properties
. In fact, you currently have an invalid schema, as all values of keys inside properties
should be objects only.
{
"$schema": "json-schema.org/draft-04/schema#",
"title": "Schema",
"description": "JSON schema for validating Json file",
"type": "object",
"properties": {
"MAX_CONNECTION_PER_HOST": {
"type": "number"
},
"QUEUE_IO_SIZE": {
"type": "number"
},
"REQUEST_LOW_WATER_MARK": {
"type": "number"
}
},
"required": [
"MAX_CONNECTION_PER_HOST",
"QUEUE_IO_SIZE",
"REQUEST_LOW_WATER_MARK"
]
}
I validated the schema against the instance using https://www.jsonschemavalidator.net for testing.
Your issue here is required
should be at the root level, and not inside properties
. In fact, you currently have an invalid schema, as all values of keys inside properties
should be objects only.
{
"$schema": "json-schema.org/draft-04/schema#",
"title": "Schema",
"description": "JSON schema for validating Json file",
"type": "object",
"properties": {
"MAX_CONNECTION_PER_HOST": {
"type": "number"
},
"QUEUE_IO_SIZE": {
"type": "number"
},
"REQUEST_LOW_WATER_MARK": {
"type": "number"
}
},
"required": [
"MAX_CONNECTION_PER_HOST",
"QUEUE_IO_SIZE",
"REQUEST_LOW_WATER_MARK"
]
}
I validated the schema against the instance using https://www.jsonschemavalidator.net for testing.
answered Nov 21 '18 at 14:31
RelequestualRelequestual
3,45263366
3,45263366
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53413872%2frapidjson-giving-validation-success-even-when-required-field-is-missing%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Thanks for your question. Would you be able to provide your JSON Schema and JSON instace outside of your code please? This allows us to check if there is an issue with the schema itself or not first. Thanks.
– Relequestual
Nov 21 '18 at 14:14
Json file is already outside the code. Just remove the backslash from g_plJsonSchema to get the schema.
– Vishal Sharma
Nov 21 '18 at 14:23
{"$schema": "json-schema.org/draft-04/schema#", "title": "Schema", "description": "JSON schema for validating Json file", "type": "object", "properties": { "MAX_CONNECTION_PER_HOST": { "type": "number" }, "QUEUE_IO_SIZE": { "type": "number" }, "REQUEST_LOW_WATER_MARK": { "type": "number" }, "required": [ "MAX_CONNECTION_PER_HOST", "QUEUE_IO_SIZE", "REQUEST_LOW_WATER_MARK"] } }
– Vishal Sharma
Nov 21 '18 at 14:23
1
I just hope I've not done any mistakes while removing backslashes.
– Vishal Sharma
Nov 21 '18 at 14:24
For future reference, it's better to edit your question to add code blocks rather than use comments, however, this was OK to work with =]
– Relequestual
Nov 21 '18 at 14:31