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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:41:55+00:00 2026-06-09T20:41:55+00:00

I have a long string (8,315 characters) worth of JSON, but I can’t seem

  • 0

I have a long string (8,315 characters) worth of JSON, but I can’t seem to write it to a .txt file using Python without it being truncated.

I write the JSON to a text file and then upload it via FTP, but both the .txt file on my system and the .txt file on the FTP server are truncated.

Here’s the code:

# Upload the results
host = ftputil.FTPHost('ftp.website.com', 'username', 'password')
jsonOutput = json.dumps(full_json)
f = open('C:/Comparison.txt', 'w')
f.write(jsonOutput)
host.upload('C:/Comparison.txt', '/public_html/Comparison.txt')
f.close()
print jsonOutput

The JSON output in the console is valid and whole, but it is truncated in the .txt file that is written (and then the .txt file after it is uploaded).

Most of the time, the output will end at http://www.digikey.com/product-detail/en/A000073/1050-10 when the full URL is actually http://www.digikey.com/product-detail/en/A000073/1050-1041-ND/3476357 (and then of course, it cuts off the rest of the JSON)

I’m not sure if this makes any difference, but I also tried f.write(re.escape(jsonOutput) with the same results.

Can anyone help with this?

  • 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-09T20:41:56+00:00Added an answer on June 9, 2026 at 8:41 pm
    with open('C:/Comparison.txt', 'w') as f:
      json.dump(full_json, f)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a long string, the format will be same of this string but
I have a long string of some characters. I want to replace some chars
I have a long text string (including \n newline characters) that I feed into
I have a long string that I want store it as a list. But
I have a long string resulted from encoding a binary file -an image file-
I have a long string witn many charaters like : 8798dsfgsd98gs87£%%001912.43.36. How can I
I have a long string. Within that string there are certain characters I need
I'm using Intellij IDEA 10.5 Community. If I have a long String and want
i have a long string that can hold all these values at the same
I have very long string returned from os:cmd. My exe-file output contains some symbols

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.