Skip to content

PLSQLAP_Document_API always wraps the JSON it generates under whatever name you pass to New_Document(), so the output ends up nested one level deeper than needed (e.g. under a wrapper key like 'MAIN_DOC') — is there a way to build a truly top-level JSON object with it instead?

Answer

PLSQLAP_Document_API always requires a root document name, so it can't produce a bare top-level object directly — the workaround is a small post-processing step: parse the resulting JSON CLOB with Oracle's native JSON_ELEMENT_T/JSON_OBJECT_T APIs, confirm it has exactly one top-level key, and re-serialize just that key's inner value back to CLOB as your final JSON. That gives you the unwrapped structure you actually want without needing PLSQLAP_Document_API to support it directly.

← Browse Developer Studio, deployment, and upgrades questions