Skip to main content
deleted 20 characters in body
Source Link
Thom A
  • 93.6k
  • 11
  • 53
  • 82

I want to extract an element from a json in a column.

However, the key of the element I am interested contains % (the exact name is: Use%).

Following this, I tried to use double quotes, however, I still have the same problem:

JSON_VALUE(results, '$."Use%"') as value

JSON text is not properly formatted. Unexpected character ''' is found at position 1.


 
  JSON_VALUE(results, '$.Use%') as value

JSON path is not properly formatted. Unexpected character '%' is found at position 5.

How can I extract the value from my json string ?


Edit:

The JSON is the following:

{'Filesystem': 'hdfs://nameservice1', 'Size': '67945349394432', 'Used': '22662944968704', 'Available': '41812184838144', 'Use%': '33%'}

I want to extract an element from a json in a column.

However, the key of the element I am interested contains % (the exact name is: Use%).

Following this, I tried to use double quotes, however, I still have the same problem:

JSON_VALUE(results, '$."Use%"') as value

JSON text is not properly formatted. Unexpected character ''' is found at position 1.


 
  JSON_VALUE(results, '$.Use%') as value

JSON path is not properly formatted. Unexpected character '%' is found at position 5.

How can I extract the value from my json string ?


Edit:

The JSON is the following:

{'Filesystem': 'hdfs://nameservice1', 'Size': '67945349394432', 'Used': '22662944968704', 'Available': '41812184838144', 'Use%': '33%'}

I want to extract an element from a json in a column.

However, the key of the element I am interested contains % (the exact name is: Use%).

Following this, I tried to use double quotes, however, I still have the same problem:

JSON_VALUE(results, '$."Use%"') as value

JSON text is not properly formatted. Unexpected character ''' is found at position 1.

  JSON_VALUE(results, '$.Use%') as value

JSON path is not properly formatted. Unexpected character '%' is found at position 5.

How can I extract the value from my json string ?

The JSON is the following:

{'Filesystem': 'hdfs://nameservice1', 'Size': '67945349394432', 'Used': '22662944968704', 'Available': '41812184838144', 'Use%': '33%'}
added 188 characters in body
Source Link
Itération 122442
  • 2.9k
  • 2
  • 39
  • 84

I want to extract an element from a json in a column.

However, the key of the element I am interested contains % (the exact name is: Use%).

Following this, I tried to use double quotes, however, I still have the same problem:

JSON_VALUE(results, '$."Use%"') as value

JSON text is not properly formatted. Unexpected character ''' is found at position 1.


  JSON_VALUE(results, '$.Use%') as value

JSON path is not properly formatted. Unexpected character '%' is found at position 5.

How can I extract the value from my json string ?


Edit:

The JSON is the following:

{'Filesystem': 'hdfs://nameservice1', 'Size': '67945349394432', 'Used': '22662944968704', 'Available': '41812184838144', 'Use%': '33%'}

I want to extract an element from a json in a column.

However, the key of the element I am interested contains % (the exact name is: Use%).

Following this, I tried to use double quotes, however, I still have the same problem:

JSON_VALUE(results, '$."Use%"') as value

JSON text is not properly formatted. Unexpected character ''' is found at position 1.


  JSON_VALUE(results, '$.Use%') as value

JSON path is not properly formatted. Unexpected character '%' is found at position 5.

How can I extract the value from my json string ?

I want to extract an element from a json in a column.

However, the key of the element I am interested contains % (the exact name is: Use%).

Following this, I tried to use double quotes, however, I still have the same problem:

JSON_VALUE(results, '$."Use%"') as value

JSON text is not properly formatted. Unexpected character ''' is found at position 1.


  JSON_VALUE(results, '$.Use%') as value

JSON path is not properly formatted. Unexpected character '%' is found at position 5.

How can I extract the value from my json string ?


Edit:

The JSON is the following:

{'Filesystem': 'hdfs://nameservice1', 'Size': '67945349394432', 'Used': '22662944968704', 'Available': '41812184838144', 'Use%': '33%'}
Source Link
Itération 122442
  • 2.9k
  • 2
  • 39
  • 84

Special character in JSON_VALUE in MSSQL 2017

I want to extract an element from a json in a column.

However, the key of the element I am interested contains % (the exact name is: Use%).

Following this, I tried to use double quotes, however, I still have the same problem:

JSON_VALUE(results, '$."Use%"') as value

JSON text is not properly formatted. Unexpected character ''' is found at position 1.


  JSON_VALUE(results, '$.Use%') as value

JSON path is not properly formatted. Unexpected character '%' is found at position 5.

How can I extract the value from my json string ?