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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:43:53+00:00 2026-06-08T23:43:53+00:00

I tried to parse a big JSON file using PHP and it always give

  • 0

I tried to parse a big JSON file using PHP and it always give me errors.
When I tried to validate the JSON file using http://jsonlint.com/ I encountered a lot of error in which there are some words separated by “unwanted” space and newline character like this:

{
                "id": "1",
                "qn
 ame": "detik.co.id.",
                "source": "undefined"
},  

notice the word “qname” is separated into “qn” and “ame”. between those two there are space and newline characters.

the correct one should look like this:

{
                    "id": "1",
                    "qname": "detik.co.id.",
                    "source": "undefined"
 },  

since there are a lot of similar error it would be painful to remove those characters manually one by one. Is there any quicker way to deal with this problem?

  • 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-08T23:43:54+00:00Added an answer on June 8, 2026 at 11:43 pm

    Depending on the data, you could just get rid of all the space and newline characters:

    tr -d ' \n' < input_json.txt > spaceless_json.txt
    

    But of course that will break if you have data with embedded spaces like:

    "var one" : 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried to parse nature magazine's feed using php and several different rss/atom reader
How do you parse this json: a:1:{i:3;a:3:{s:8:routtype;s:9:Alpha SS7;s:6:credit;d:4532.600000000000363797880709171295166015625;s:8:validity;s:3:276;}} to php object or array? Tried
I tried to parse the link on rss feed with images using php .
I tried but i was unable to parse this json object which comes from
I am trying to parse the resultlist of http://mobile.de . First I tried it
I am parsing a binary file using a specification. The file comes in big-endian
I'd like to parse a big XML file on the fly. I'd like to
I got a big issue when trying to parse json data in xcode. I
I need to parse a very big XML file, with a filesize of 750Mo
I tried to parse following String using TBXML. <panel><start><post_id>4</post_id><user_id>2</user_id><post>Hyder here</post><created_on>2012-01-09 06:36:59</created_on><likes>0</likes><noc>0</noc><status>A</status></start><start><post_id>3</post_id><user_id>2</user_id><post>Hello hyder here</post><created_on>2012-01-09 06:34:09</created_on><likes>0</likes><noc>0</noc><status>A</status></start><start><post_id>2</post_id><user_id>0</user_id><post>Hi,

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.