Comments (8)
I'll use this issue, thanks.
from json-everything.
Hey there. You can use double quotes for the string.
$[?(@.Name == "how do I escape a single' quote here?")]
Then you don't need to escape it.
Otherwise, you'll use a backslash \
to escape.
from json-everything.
Thank you so much for responding, and for all the work you do on this amazing library!
I think the escaping may not be working for single quotes in strings surrounded by single quotes, since this fails to parse
$[?(@.Name == 'how do I escape a single\' quote here?')]
Also, the string I am working with may contain single quotes or double quotes (it is dynamic), so I may still have to use escaping if I use double quotes to surround the string. Good news is -- escaping seems to be working as expected for double quote strings.
Do you think I should open a new issue with a type of "bug" for parsing failing with the escaped single quotes?
from json-everything.
This is a bug and the parser need to do an escaping, I'm currently parse strings to a seq[String]
and then call a mkString
to get the final result string.
I think this issue can be added to the test suite too.
final JsonPathAST.JsonPathQuery query = JsonPath.parseQuery("$['how do I escape a single\\' quote here?']");
Assertions.assertEquals("how do I escape a single' quote here?",
((Selector.NameSelector) query.segments().get(0).selection().selectors().get(0)).name());
from json-everything.
This is a bug
Yes, as labeled.
from json-everything.
The test suite has these two tests which seem to confirm I do handle them. I wonder what the difference is between being able to handle these and not being able to handle your case:
{
"name": "name selector, single quotes, escaped single quote",
"selector": "$['\\'']",
"document": {
"'": "A"
},
"result": [
"A"
]
},
{
"name": "name selector, single quotes, escaped reverse solidus",
"selector": "$['\\\\']",
"document": {
"\\": "A"
},
"result": [
"A"
]
}
Might be that yours is in an expression and these tests are in selectors, but I'd expect that uses the same parsing code...
from json-everything.
It doesn't! I'm going to add this to the test suite and then fix it here.
from json-everything.
It doesn't! I'm going to add this to the test suite and then fix it here.
Thank you so much!
from json-everything.
Related Issues (20)
- Possibly wrong return type HOT 10
- Customizing the `format` generated for a field (without attributes) HOT 5
- Json.Schema.KeywordExtensions is not thread safe with custom keywords HOT 1
- Update Nuget package meta-data HOT 6
- Error "unknown context value" Raised After Checking for Existence HOT 2
- Online schema validator: Is successful validation of illegal json just a quirk or intentional HOT 5
- System.MissingMethodException for IReadOnlyCollection<JsonNode> after updating from JsonSchema.Net.Generation 4.3.0 to 4.3.0.2 HOT 5
- Can't get DiscriminatorKeyword working HOT 2
- Schema Evaluation fails with "Cannot resolve schema at {uri}" HOT 5
- Could not load file or assembly 'JsonPointer.Net, Version=5.0.0.0, Culture=neutral, PublicKeyToken=17ed63f672b0e278'. The system cannot find the file specified. HOT 10
- IndexOutOfRangeException occurred when evaluating schema with parallel execution. HOT 1
- jsonnet as sister of json-e HOT 3
- Extract data annotation attributes from JsonSchema.Net.Generation into separate project HOT 2
- Is there a way to do JSON validation that does case insensitive matching on property names? HOT 8
- Support language packs in schema playground
- sileo-featured.json
- How to export or save JsonSchema to plaintext? HOT 4
- How to write a JsonSchemaBuilder for a class that has a property of a class? HOT 4
- Schema generation doesn't work on site HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from json-everything.