Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8561489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:30:45+00:00 2026-06-11T16:30:45+00:00

I am having issues with a properly formatted json string, I believe. I am

  • 0

I am having issues with a properly formatted json string, I believe. I am wondering if it is due to the construction of the query string, but it looks right to me, unless it’s an issue with the double brackets that are in the encoded json string below. Looking for an extra set of eyes.

Before json encoding, var_dump($considerationCodes) looks like:

array (size=2)
  8 => 
    array (size=13)
      67 => 
        array (size=1)
          0 => 
            array (size=3)
              ...
      41 => 
        array (size=1)
          0 => 
            array (size=3)
              ...
      42 => 
        array (size=1)
          0 => 
            array (size=3)
              ...

print json_encode($considerationCodes); looks like:

$considerationCodes = 
{"8": {"67":  [[  {"id":"64","description":"string description..."},{"id":"65","description":"string description..., "},{"id":"66","description":"string description..."}  ]]  , "41":  [[  {"id":"64","description":"string description..."},{"id":"65","description":"string description..., "},{"id":"66","description":"string description..."}  ]] }}  

Json structure how it is expected/accepted (tested and works with raw data):

['8']['67']['64'] = "string description...";
['8']['67']['65'] = "string description...";
['8']['67']['66'] = "string description...";
['8']['41']['64'] = "string description...";
['8']['41’]['65'] = "string description...";
['8']['41']['66'] = "string description...";
...etc

And this is how I submit the json encode (tested and works with raw data):

return $this->renderText(json_encode( $considerationCodes[$appCode][$reasonCode] ) ); 

When I look at the results of this json submission (a multiple choice select input), it looks like:

[Object][object][Object][object][Object][object][Object][object]

What am I missing?

EDIT:

This is how I have constructed my arrays:

$reason_codes_ids = array();
        foreach($all_reason_codes as $key => $values) {
            $reason_codes_ids[] = $values['id'];
        }
        //wrap the consideration_info into each reason_id:        
        $codes_with_reasons = array();
        foreach($reason_codes_ids as $value){
            foreach($consideration_info as $key => $value1){
                $codes_with_reasons[$value][$key] = $value1;
            }
        }
        //the above results in: ['reason-code-id']['consideration-code-id'] = "consideration-code-answer":
        //next, get the declined_app_status:
        $declinedAppStatus = 8;
        //then wrap the above results in a wraper for the declined application-code
        $declinedConsiderationCodes = array();
        foreach($codes_with_reasons as $key => $value)
        {
            $declinedConsiderationCodes[$declinedAppStatus][$key]=[$value];
        }
        $considerationCodes = $declinedConsiderationCodes;

and:

$consideration_info =

array (size=3)
  0 => 
    array (size=2)
      'id' => string '64' (length=2)
      'description' => string 'string...' (length=35)
  1 => 
    array (size=2)
      'id' => string '65' (length=2)
      'description' => string ''string...' (length=143)
  2 => 
    array (size=2)
      'id' => string '66' (length=2)
      'description' => string ''string...' (length=143)

$reason_codes_ids =

array (size=13)
  0 => string '67' (length=2)
  1 => string '41' (length=2)
  2 => string '42' (length=2)
  3 => string '43' (length=2)
  4 => string '44' (length=2)
  5 => string '45' (length=2)
  6 => string '46' (length=2)
  7 => string '47' (length=2)
  8 => string '48' (length=2)
  9 => string '49' (length=2)
  10 => string '50' (length=2)
  11 => string '51' (length=2)
  12 => string '68' (length=2)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T16:30:46+00:00Added an answer on June 11, 2026 at 4:30 pm

    With proper formatting and indentation, your JSON string looks like this:

    {
        "8": {
            "67": [
                [
                    {
                        "id":"64",
                        "description":"string description..."
                    },
                    {
                        "id":"65",
                        "description":"string description..., "
                    },
                    {
                        "id":"66",
                        "description":"string description..."
                    }
                ]
            ],
            "41": [
                [
                    {
                        "id":"64",
                        "description":"string description..."
                    },
                    {
                        "id":"65",
                        "description":"string description..., "
                    },
                    {
                        "id":"66",
                        "description":"string description..."
                    }
                ]
            ]
        }
    }
    

    Notice that ['8']['67'] is an array with numeric indexes. To do what it looks like you want to do, your JSON string should look more like this: (sample)

    {
        "8": {
            "67": {
                "64":"string description...",
                "65":"string description..., ",
                "66":"string description..."
            },
            "41": {
                "64":"string description...",
                "65":"string description..., ",
                "66":"string description..."
            }
        }
    }
    

    And so your PHP array should look more like this:

    $considerationCodes = array(
        "8" => array(
            "67" => array(
                "64" => "string description...",
                "65" => "string description..., ",
                "66" => "string description..."
            ),
            "41" => array(
                "64" => "string description...",
                "65" => "string description..., ",
                "66" => "string description..."
            )
        )
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having issues getting my results properly limited in a query. I have a
I'm having issues properly setting up my Hibernate configuration. After trying to extend the
I'm having a few issues with a client's website not displaying properly in IE.
Having some trouble sending properly formatted HTML e-mail from a PHP script. I am
I am having some problems building a properly formatted SOAP message using XMLDocument in
I'm having issues trying to deserializing my xml string that was from a dataset..
I'm relatively new to JS and I'm having issues properly emulating OOP principles. I
I'm having issues getting the customer.xml layout file to work properly for the customer's
I'm having issues getting the C sockets API to work properly in C++ on
I love using the TODO list in TextMate but I've been having issues of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.