How to escape a period in mySql JSON query

Kartik Gautam

I am working on a project where i am required to store data in JSON format using mySQL DB. I want to store data in this format:

{
 email1:{ data:"This is some data of email1", status:"registered", count:100 },
 email1:{ data:"This is some data of email2", status:"unregistered", count:230 },
}

Here email1 & email2 are two emails of someone acting as a key. while executing queries to store and retrieve data in this format, i discovered that emails could contain periods in them too, for example: [email protected] or [email protected].

And due to presence of period in keys i am unable to execute json queries in DB. Like: SELECT JSON_EXTRACT(analytics, "[email protected]") FROM EmailsData; Does not work due to presence of periods in [email protected] and give me this error :

Error Code: 3143. Invalid JSON path expression. The error is around character position 8.

Can someone suggest me how can i escape these periods inside query and if not then what will be best way to store data in JSON format for respective emails?

Örvar

You will need to use single quotes similar to the following:

'$."[email protected]"'

Please give it try.

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

How do i escape both backslash and double quotes in a single query while export MySQL outfile csv

分類Dev

How to properly escape %s in sql query

分類Dev

Best way to escape array of data on MysQl nodeJS query

分類Dev

How to parse Json data, which is made by select mysql query?

分類Dev

how to select exact json value in mysql query condition

分類Dev

Escape apostrophe in Query of Query

分類Dev

Subset a JSON Object with MySQL Query

分類Dev

How to escape question mark (?) character in PDI Pentaho in a query

分類Dev

Using PostgreSQL, how do I escape "\" in json columns?

分類Dev

How to escape JSON values with Single Quotes(apostrophe) within JavaScript function

分類Dev

how to convert mysql query to zend query?

分類Dev

how can i transform a mysql query "group by statement" result to a json structure?

分類Dev

How to check performance of mysql query?

分類Dev

How to combine "LIKE" with "IN" in a MYSQL query?

分類Dev

How to order a MySQL query by range?

分類Dev

How to pass & symbol in MySQL query?

分類Dev

Escape an '@' character in a SQL query / ActiveRecord

分類Dev

Sql query - getting history data with time period

分類Dev

Node-MySQL-Query()メソッドとMysql.Escape()/ Mysql.EscapeId()でのエスケープ

分類Dev

how to improve mysql query speedy with indexes?

分類Dev

How to get database structure in MySQL via query

分類Dev

How to get a mysql query to use a specific index?

分類Dev

How to do multiple counts in a MYSQL select query?

分類Dev

How to display zero values in mysql query?

分類Dev

How to do this query against MySQL database table?

分類Dev

How to use common parameter for Mysql PDO query

分類Dev

Mysql: How to query with if else condition inside if

分類Dev

How to write a calculation query in MySQL with 2 tables?

分類Dev

Not sure how to approach this with a mySQL query for two tables

Related 関連記事

  1. 1

    How do i escape both backslash and double quotes in a single query while export MySQL outfile csv

  2. 2

    How to properly escape %s in sql query

  3. 3

    Best way to escape array of data on MysQl nodeJS query

  4. 4

    How to parse Json data, which is made by select mysql query?

  5. 5

    how to select exact json value in mysql query condition

  6. 6

    Escape apostrophe in Query of Query

  7. 7

    Subset a JSON Object with MySQL Query

  8. 8

    How to escape question mark (?) character in PDI Pentaho in a query

  9. 9

    Using PostgreSQL, how do I escape "\" in json columns?

  10. 10

    How to escape JSON values with Single Quotes(apostrophe) within JavaScript function

  11. 11

    how to convert mysql query to zend query?

  12. 12

    how can i transform a mysql query "group by statement" result to a json structure?

  13. 13

    How to check performance of mysql query?

  14. 14

    How to combine "LIKE" with "IN" in a MYSQL query?

  15. 15

    How to order a MySQL query by range?

  16. 16

    How to pass & symbol in MySQL query?

  17. 17

    Escape an '@' character in a SQL query / ActiveRecord

  18. 18

    Sql query - getting history data with time period

  19. 19

    Node-MySQL-Query()メソッドとMysql.Escape()/ Mysql.EscapeId()でのエスケープ

  20. 20

    how to improve mysql query speedy with indexes?

  21. 21

    How to get database structure in MySQL via query

  22. 22

    How to get a mysql query to use a specific index?

  23. 23

    How to do multiple counts in a MYSQL select query?

  24. 24

    How to display zero values in mysql query?

  25. 25

    How to do this query against MySQL database table?

  26. 26

    How to use common parameter for Mysql PDO query

  27. 27

    Mysql: How to query with if else condition inside if

  28. 28

    How to write a calculation query in MySQL with 2 tables?

  29. 29

    Not sure how to approach this with a mySQL query for two tables

ホットタグ

アーカイブ