1

How can I retrieve content from below json by using pl/sql json from http://sourceforge.net/projects/pljson/?

{"errors":["Invalid weight","Invalid pallet spots"]}

I want to get text like this 1. Invalid weight, 2. Invalid pallet spots.

Thanks

1 Answer 1

1

This is actually quite simple:

DECLARE
    obj json := json();
    arr json_list := json_list();
BEGIN
    obj := json('{"errors":["Invalid weight","Invalid pallet spots"]}');
    arr := json_list(obj.get('errors'));

    dbms_output.put_line(arr.get(1).get_string());
    dbms_output.put_line(arr.get(2).get_string());
END;
/

You might also want to have a look at my own (performance optimized) version of a json library for PL/SQL @ https://github.com/doberkofler/PLSQL-JSON

Sign up to request clarification or add additional context in comments.

1 Comment

Hello @materialdreams, your work its useful 2 me, thanks a lot!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.