Invalid JSON path expression. The error is around character position 2.

Problem Description:

At that time, I wrote a mysql function, mainly to process the json object array data, and then first loop the json array, and then found
jsonarray->>'$[i].educationalLevel'that the syntax was wrong, which should not be abnormal normally.

insert image description here
The error message is as follows:

insert image description here

Solution process:

I guess it is icaused by variables, so I jsonarray->>'$[i].educationalLevel'changed it to the following:

JSON_UNQUOTE(JSON_EXTRACT(jsonarray,CONCAT('$[',i,'].technicalTitles')));

->>It is equivalent to JSON_UNQUOTE(JSON_EXTRACT());the difference between these two, the point is that this variable imay not be recognized as a number, so here is used to write CONCATthe variable iseparately, so it is ok.

Guess you like

Origin blog.csdn.net/weixin_43888891/article/details/130829582
Recommended