You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Problem when decoding json from oci compute instance list output in php

edited Nov 10, 2024 2:04PM in OCI - General 1 comment

I use php and I want to decode the json output from the command oci compute instance list.

In Powershell, This works fine to display the raw json:

php -r "var_dump(shell_exec('oci compute instance list --compartment-id ocid1.tenancy.oc1..removed'));"

But this returns NULL:

php -r "var_dump(json_decode(shell_exec('oci compute instance list --compartment-id ocid1.tenancy.oc1..removed')));"

If I strip off the "processor-description" field from the json output before decoding, it decodes successfully. So it appears there are problem characters within it causing this.

The contents of "processor-description" are:

"processor-description": "3.0 GHz Ampere® Altra™",

Tagged:

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!