Dimassik
Dimassik

Reputation: 3

How to parse this JSON where name has ','

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?

Upvotes: 0

Views: 721

Answers (1)

James Sumners
James Sumners

Reputation: 14777

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.

Upvotes: 0

Related Questions