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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:33:22+00:00 2026-05-31T07:33:22+00:00

I have a 1GB json file and i want to parse it using simplejson

  • 0

I have a 1GB json file and i want to parse it using simplejson in python. So i wrote a simple code as below which works fine

import simplejson
f=open('stem.json','r')
content=f.read()
data=simplejson.loads(content)

The problem with the above code is that it does not read data in ‘utf-8’ format

So i rewrote the code as below

import simplejson 
import codecs
f=codecs.open('stem.json','r',encoding='utf-8')
content=f.read()
data=simplejson.loads(content)

The problem with the above code is it wont execute, kernel is “Killing” the program.

I feel this problem is strange because without encoding it works and when i try to read it with encoding it takes lot of memory

Can anyone tell me whats happening here ?

  • 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-31T07:33:23+00:00Added an answer on May 31, 2026 at 7:33 am

    You could try to open the file normally and use simplejson.load() with an encoding parameter instead of reading the whole file into memory first:

    with open("stem.json", "r") as f:
        data = simplejson.load(f, encoding="utf-8")
    

    As I said in the comment above, I think the real solution is to use a different persistence backend, other than serialising to JSON.

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

Sidebar

Related Questions

I have a large raw data file (up to 1GB) which contains raw samples
I'm using Python 2.6 on a Mac Mini with 1GB RAM. I want to
I have a CSV file which is about 1GB big and contains about 50million
Say I have a very large file (say > 1GB) and I want to
i have to parse files logs (5gb) error logs (1gb) import data file (csv)
Have just started using Visual Studio Professional's built-in unit testing features, which as I
I have a 1GB binary file on another system. Requirement: ftp/download and convert binary
I have a large xml file (1Gb). I need to make many queries on
I have 100 training, lecture, guide video files which has size 30MB to 1GB
I'm working on #huge# text files (from 100mb to 1gb), I have to parse

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.