Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

How do i find the name of the 1st element

2010-01-06
2013-05-28
  • marc weinstock
    marc weinstock
    2010-01-06

    How do i find the name of the 1st element?  in some of the json structures I need to read through, I do not know the "xyz" or "name0", or "name1" name.  I can be anything.  Is there a way to get a array of names?  If not, I only need to know the name of the first element, all others are known to me.  So a get_first_name would work.

        {  "xyz" : {
           "abc" : [1,2,3,] }
        }
        Or:
            {  "name0" : {
           "abc" : [1,2,3,] }
        }
        Or:
            {  "name1" : {
           "abc" : [1,2,3,] }
        }
       

    thanks!

     
  • You could add a method to the json object type.
    Something like this:

    member function get_name(position pls_integer default 1) return varchar2 as
    begin
      return json_data(position).member_name;
    end;