0

I run next example

declare
    obj json := json('{"TR,A" : "OK" }');
begin
    dbms_output.put_line(JSON_EXT.GET_STRING (obj, 'TR,A'));
end;

and receive a message

ORA-20110: JSON Path parse error: expected . or [ found , at position 4
ORA-06512: at "SCOTT.JSON_EXT", line 193
ORA-06512: at "SCOTT.JSON_EXT", line 201

What is the work around?

dvhh
  • 4,724
  • 27
  • 33
Dimassik
  • 3
  • 1

1 Answers1

0

The following code works for me:

declare
  my_json json := json('{"TR,A" : "OK" }');
begin
  dbms_output.put_line(my_json.get('TR,A').to_char);
end;

You should work directly with the JSON type. You should only have to resort to using packages like JSON_EXT if the type methods are insufficient for your use case.

James Sumners
  • 14,485
  • 10
  • 59
  • 77
  • Thank you for the answer, but `JSON` type gives me the same error when I try this `declare my_json json := json( '{ "T": { "R": { "TR,A": "OK" } } }'); begin dbms_output.put_line(my_json.path('T.R.TR,A').to_char); end;` – Dimassik Mar 18 '15 at 09:44
  • @Dimassik please try `my_json.path('T.R[''TR,A'']')`, see http://goessner.net/articles/JsonPath/ – Pavel Gatnar Mar 18 '15 at 11:14
  • And if you can control the value of the key name, try using a `-` instead of a `,`. – James Sumners Mar 18 '15 at 12:46