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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:00:12+00:00 2026-05-31T20:00:12+00:00

I have a JSON string (external file) which has an element which can either

  • 0

I have a JSON string (external file) which has an element which can either have FALSE or TRUE as a value. In the file, the true or false IS there. However, after I use json_decode on it, the true or false is lost. Why?

The JSON is valid, it is made from many blocks of

{
   "surroundedDebuff":true,
   "citizenId":108981,
   "citizenship":19,
   "berserk":true,
   "defenderSide":false,
   "weapon":0,
   "time":"25-03-2012 16:07:13:442",
   "damage":65
}

(this repeated many times), the checking is a simple print_r.

  • 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-05-31T20:00:13+00:00Added an answer on May 31, 2026 at 8:00 pm

    print_r doesn’t show types, so it will display 0 for false and 1 for true. var_dump will show that the values are actually booleans.

    $decoded = json_decode('{"surroundedDebuff":true,"citizenId":108981,"citizenship":19,"berserk":true,"defenderSide":false,"weapon":0,"time":"25-03-2012 16:07:13:442","damage":65}');
    
    print_r($decoded);
    var_dump($decoded);
    

    Outputs:

    stdClass Object
    (
        [surroundedDebuff] => 1
        [citizenId] => 108981
        [citizenship] => 19
        [berserk] => 1
        [defenderSide] => 
        [weapon] => 0
        [time] => 25-03-2012 16:07:13:442
        [damage] => 65
    )
    object(stdClass)#1 (8) {
      ["surroundedDebuff"]=>
      bool(true)
      ["citizenId"]=>
      int(108981)
      ["citizenship"]=>
      int(19)
      ["berserk"]=>
      bool(true)
      ["defenderSide"]=>
      bool(false)
      ["weapon"]=>
      int(0)
      ["time"]=>
      string(23) "25-03-2012 16:07:13:442"
      ["damage"]=>
      int(65)
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this JSON string: { success:true,user_id:309,id:309,sessId:false,email:null,name:Mai Van Quan,username:quanmv,role:Reseller Admin,messages:,org_name:null,microPayNumber:4949,microPayWord:neocam,mobile:null,permissions:{ADD_CAMERA:true, REMOVE_CAMERA:true, EDIT_CAM_GENERAL:true, ACCESS_CAM_TECHNICAL:true, EDIT_CAM_PKG:true,
I have the following JSON string coming from external input source: {value: "82363549923gnyh49c9djl239pjm01223", id:
I have a method which requests external webservices and returns json here: public string
I have a JSON string that looks something like this: {addresses:{address:[{@array:true,@id:888888,@uri:xyz,household:{@id:44444,@uri:xyz},person:{@id:,@uri:},addressType:{@id:1,@uri:xyz,name:Primary},address1:xyz,address2:null,address3:null,city:xyz,postalCode:111111}]}} What would be
We have two systems: external and internal, which are sharing information in JSON format
If I am to have this external json file: { http://example.org/about : { http://purl.org/dc/elements/1.1/title
I have a JSON string that has 1-n numbers of lat/lng records. It looks
I have JSON string that has nested objects with dynamic names that vary each
I have a json string saved in my db. When i retrieve it from
I have converted my Datatable to json string use the following method... public string

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.