Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

generic / variable reference to json array field name

607218Nov 23 2009 — edited Nov 24 2009
hi -- I have a javascript function that I want to make variable-based, so it can be used throughout my application.

It creates and parses a json object. I ultimately need to reference a field in that object. The field name is the name of database column
that was queried in the called application process.

For example, if the query executed was: select my_id from my_table where my_name = 'the_name', and the object that holds the parsed
AJAX response is jsonobj, then I need to reference: jsonobj.row[0].my_id

I don't want my_id to be hardcoded in the reference. Rather, I want to pass the string 'my_id' into the javascript function (let's call
the variable dest_item_name) and then reference (something like): jsonobj.row[0].<dest_item_name>.

(How) can I do this? Please tell me I can! :)

Thanks,
Carol
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 22 2009
Added on Nov 23 2009
5 comments
580 views