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

  • Home
  • SEARCH
  • 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 6745277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:11:07+00:00 2026-05-26T12:11:07+00:00

I’m doing JSON parser in php for some API that stores informations about estates.

  • 0

I’m doing JSON parser in php for some API that stores informations about estates. I’m getting problem with the parse, since it’s returning me NULL vualue instead of an array or object. Simple JSON codes are parsed nicely, but with this:

{"success":true,"totalCount":1,"data":[{"id":996944,"listingId":"2/2089/OMW","mlsId":null,"swoId":null,"sectionName":"ApartmentRental","geoLat":50.06442971278027,"geoLng":19.953176730749647,"country":{"id":34,"name":"Polska","code":"PL"},"location":{"id":42955,"name":"/Małopolskie/Kraków/Kraków-Śródmieście","province":"Małopolskie","locality":"Kraków","quarter":"Kraków-Śródmieście"},"street":{"id":138781,"name":"Hugona Kołłątaja","fullName":"ul. Hugona Kołłątaja"},"foreignStreet":null,"foreignLocation":null,"contractType":"Exclusive","ownershipType":"Mortgage","groundOwnershipType":null,"isSpecial":true,"price":{"amount":2700,"currency":"PLN"},"priceBeforeReduction":null,"dateCreated":"2011-10-22 20:32:35","lastUpdated":"2011-10-25 11:51:09","actualisationDate":"2011-10-22 20:32:34","statusChangeDate":"2011-10-22 20:32:34","images":[{"id":6514430},{"id":6514431},{"id":6514432},{"id":6514433},{"id":6514434},{"id":6514435},{"id":6514436},{"id":6514437},{"id":6514438},{"id":6514439},{"id":6514440},{"id":6514441},{"id":6514442},{"id":6514443}],"licenceNumber":null,"description":"Do wynajęcia piękne, przestronne mieszkanie w wysokim standardzie, świeżo po remoncie przy ulicy Hugona Kołłątaja w Krakowie. Znajduje się w bardzo pięknej z zewnątrz i wewnątrz kamienicy. Bardzo dobra komunikacja, duża powierzchnia 85m2 i wysoki standard wykończenia dają poczucie komfortu. Bardzo blisko Rynku Głównego, Hali Targowej i Galerii Kazimierz. Dzięki bardzo dobrze rozwiniętej komunikacji miejskiej możliwość szybkiego dostania się w każde miejsce Krakowa. Blisko wiele punktów handlowych i usługowych.\n\nMieszkanie składa się 3 odzielnych pokoi, przedpokoju, kuchni oraz 2 łazienek i balkonu. Jest możlwość umeblowania mieszkania według Państwa preferencji na koszt Właściciela. Ogrzewanie własne samodzielne. Możliwość podłączenia Internetu i telefonu.\n\n","englishDescription":null,"russianDescription":null,"parentListingId":null,"totalArea":85,"priceM2":{"amount":31.76,"currency":"PLN"},"noOfFloors":null,"floorNo":null,"furnished":true,"auctionStartingPrice":null,"auctionFrom":null,"auctionTo":null,"openDaysFrom":null,"openDaysTo":null}]}

i get: NULL

Although online parser like http://json.parser.online.fr/ is doing the work just fine.

I was using php built-in funcion json_decode, and some more from php.net, done by users.

Here’s my php code:

    $url="url_to_json";
$str=file_get_contents($url);
$str = substr($str, 1, strlen($str) - 2); 
$str = preg_replace("/([a-zA-Z0-9_]+?):/" , "\"$1\":", $str); 
$new=(json_decode($new, true));
var_dump($new);

Any ideas?

  • 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-26T12:11:08+00:00Added an answer on May 26, 2026 at 12:11 pm

    Please use json_decode(); on the raw JSON data. As long as it is valid JSON you don’t need any extra code to be able to access this smoothly.

    Access the returned value as an array.

    $arr = json_decode(file_get_contents($json));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace

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.