Json for special key
See original GitHub issueHello, I have some data like
{
"318":{
"cid":8,
"xPath":"//*[@id=\"app\"]/div[1]/div[2]/div[1]/div[1]/div[2]/div[1]/p[411]"
},
"329":{
"cid":7,
"xPath":""
}
}
var readPostion = await _context.UserData.Where(x => x.UserId == userId)
.Select(x => x.ReadPosition[bid.ToString()])
.FirstOrDefaultAsync();
ReadPosition is JObject
, bid is int
They generated sql statements like this
SELECT JSON_EXTRACT(`u`.`read_position`, '$.318')
FROM `user_data` AS `u`
WHERE `u`.`user_id` = 2
LIMIT 1
and throw an error Invalid JSON path expression. The error is around character position 5.
The correct one should be like this
SELECT JSON_EXTRACT(`u`.`read_position`, '$."318"')
FROM `user_data` AS `u`
WHERE `u`.`user_id` = 2
LIMIT 1
Is this a bug, or am I missing something?
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top Results From Across the Web
Which characters are valid/invalid in a JSON key name?
For JSON, the characters required to be escaped are the quotation mark, backslash, and control characters. For Javascript, the characters ...
Read more >Valid Key Names in JSON - REST
JSON Keys must be Valid Strings ... According to JSON.org, a string is a sequence of zero or more Unicode characters, wrapped in...
Read more >Accessing a JSON object with special Characters
Hi, I'm trying to access a specific value and the JSON object has a special character (@) and I'm lost about how to...
Read more >Find and replace all special characters in all json keys
Find and replace all special characters in all json keys. So I have a new line delimited JSON { "foo-bar":"foo-baar", "foob@r":"bar.foo", ...
Read more >How to Reference JSON Keys that Contain Special ...
How to Reference JSON Keys that Contain Special Characters when using OPENJSON, JSON_QUERY, and JSON_VALUE (SQL Server).
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
my
Pomelo.EntityFrameworkCore.MySql
is6.0.0
the result is same
my config
hi,
x.ReadPosition.Root[bidString]
has same problemx.ReadPosition.GetValue[bidString]
is ok , but he generated such sql statementCannot query in sql statement