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 8734107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:46:38+00:00 2026-06-13T09:46:38+00:00

So I have this JSON object: [ { branch_id: 1, issue_id: 1, user_id: 5,

  • 0

So I have this JSON object:

[
    {
        "branch_id": "1",
        "issue_id": "1",
        "user_id": "5",
        "parent_id": null,
        "level": "1",
        "name": "troll",
        "description": "yup",
        "add_date": "2012-10-24 20:26:04",
        "children": [
            {
                "branch_id": "2",
                "issue_id": "1",
                "user_id": "5",
                "parent_id": "1",
                "level": "2",
                "name": "sdad",
                "description": "dssfsd",
                "add_date": "2012-10-24 20:52:52",
                "children": [
                    {
                        "branch_id": "4",
                        "issue_id": "1",
                        "user_id": "5",
                        "parent_id": "2",
                        "level": "3",
                        "name": "fdgffd",
                        "description": "ghjjhjghjj",
                        "add_date": "2012-10-25 17:51:53",
                        "children": []
                    }
                ]
            }
        ]
    },
    {
        "branch_id": "3",
        "issue_id": "1",
        "user_id": "5",
        "parent_id": null,
        "level": "1",
        "name": "dgdfg",
        "description": "dfgfgdfg",
        "add_date": "2012-10-24 20:52:52",
        "children": []
    }
  ]

For some reason, when I try to decode it with PHP’s json_decode, it doesn’t output anything. The object can’t be invalid, because both JSONLint and this parser parse it correctly and throw no errors. PHP’s own json_last_error method doesn’t throw any errors either.

I think the non-existent output might have something to do with the object having multidimensional arrays, but I’m not sure. What do you think?

EDIT

A little background here:

This JSON object is retrieved from this file. It’s from an (in development) API, and this particular resource returns a JSON object from a certain “branch collection”.
I fetch this JSON object to PHP with cUrl, here’s the code for that:

$ch = curl_init('http://skibb.it/api/issues/branches?issue_id=1');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 0);
$branches = curl_exec($ch);
curl_close($ch);

That should be also error free, because it gets the plain JSON object correctly. But when I try:

$branches = json_decode($branches);
var_dump($branches); //Or print_r($branches);

It just doesn’t output anything, except NULL.

FINAL EDIT

Yup, this is embarassing. Found out after looking through the code, that I had accidentaly left a print_r() in the encoding process during debugging phase, which outputted the JSON object and a number 1 after it. But thanks for the replies, they were helpfull in distinguishing the problem’s source!

  • 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-13T09:46:38+00:00Added an answer on June 13, 2026 at 9:46 am

    There is nothing wrong with your JSON. As you say, it parses correctly. Just so you are aware, when you “decode”, nothing gets outputted. You still have to do something with it. Don’t expect to see a dump after the decode.

    See here:

    http://codepad.org/LyRSQNPG

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have this JSON object: {error:null, result:[{id:1234567890, count:1, recipients: [u3848, u8958, u7477474 ], dateCreated:2012-06-13T09:13:45.989Z
I have this JSON object {stores:{ 1:{ name:Publix, address:1fbdfhbdhsdhsrh, long:-84.012502, lat:33.878952}, 2:{ name:Publix, address:fgsregerge,
I'm working on JavaScript and I have this JSON object: var obj ={name :
We have JSON object as follows. { AdvanceNotificationDays:null, Egos:[], Interests:[], Name:Birthday gift for Ruchir,
I have this json object : { msg_id:134, message:Dick, comment:[ { com_id:9, comment:test, msg_id:134,
I have no idea how to properly 'return' this JSON object (in JavaScript): function
I have a json object that looks something like this: Array ( [algorithm] =>
I have this JSON response string: {d:{\ID_usuario\:\000130\,\Nombre\:null,\Vipxlo\:0,\Provmun\:null,\Descuentos\:null,\Listaviplocal\:null}}` With this code: - (void)connectionDidFinishLoading:(NSURLConnection *)connection {
I have this application where I read a sequence of JSON object ... say,
I have a JSON object that looks like this. [ { id : 23,

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.