× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hello All,

I was able to get the name and country of JSON array below if it starts with a curly bracket:
{"items":[{"name": "MyFirstCompany","country": "DE"},{"id": 2,"name": "MySecondCompany", "country": "DE"}]}

using this SQL command:
with y as (
Select * from JSON_TABLE(get_clob_from_file('/test.json'), '$'
columns( nested '$.items[*]' columns(
"name" varchar(30),
"country" varchar(02)
) ) ) x ) select * from y with ur;

However, the JSON data I want to parse starts with a square bracket and looks like this:
'[{"name": "MyFirstCompany","country": "DE"},{"id": 2,"name": "MySecondCompany", "country": "DE"}]'

But I wasn't able to get any rows using this command:
with y as (
Select * from JSON_TABLE(
'[{"name": "MyFirstCompany","country": "DE"},{"id": 2,"name": "MySecondCompany", "country": "DE"}]', '$'
columns(
nested 'lax $[*]' columns(
"name" varchar(30),
"country" varchar(02)
) ) ) x
) select * from y with ur;

Kindly advise on correct command on parsing JSON array that starts with a square bracket.

Thanks,
Lynelle


________________________________

This message is for the designated recipient only and may contain privileged, proprietary, or otherwise confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the e-mail by you is prohibited. Where allowed by local law, electronic communications with Accenture and its affiliates, including e-mail and instant messaging (including content), may be scanned by our systems for the purposes of information security and assessment of internal compliance with Accenture policy. Your privacy is important to us. Accenture uses your personal data only in compliance with data protection laws. For further information on how Accenture processes your personal data, please see our privacy statement at https://www.accenture.com/us-en/privacy-policy.
______________________________________________________________________________________

www.accenture.com

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.