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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T19:06:01+00:00 2026-06-18T19:06:01+00:00

I have this very short JSON-code in a utf-8 without BOM-encoded file: { paths:

  • 0

I have this very short JSON-code in a “utf-8 without BOM”-encoded file:

{ "paths": ["A:\\path\\to\\dir"],
  "anotherPath": "os.path.join(os.path.dirname( __file__ ), '..')"
}

I ensured its validity with different online JSON validators.
But with following Python code…

jsonfile = "working\\path\\to\\myProgram.conf"
with open(jsonfile) as conf:
    confContent = json.load(conf)
# doStuff...

… I receive this error:

No JSON object could be decoded

I know that the path is correct, because I read its content successfully at a different place.
Any ideas what could be wrong?

  • 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-18T19:06:02+00:00Added an answer on June 18, 2026 at 7:06 pm

    The problem is that you don’t actually have a file encoded as UTF-8 without BOM.

    You can generate a file with that string encoded that way as follows:

    u='''{ "paths": ["A:\\path\\to\\dir"],
      "anotherPath": "os.path.join(os.path.dirname( __file__ ), '..')"
    }'''
    s=u.encode('utf-8')
    with open('test.json', 'wb') as f:
        f.write(s)
    

    (Whether the 'b' is necessary or not depends on whether you’re on Python 2 or 3, and whether you’re on Windows or Unix. But if it’s not necessary, it’s harmless.)

    Now, if you run your code against that file, it works.

    But you can compare the test.json file to your working\\path\\to\\myProgram.conf file and see what the difference is. (Most non-Windows systems come with command-line tools like hexdump; on Windows you may have to get a little fancier to spot the differences.)

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

Sidebar

Related Questions

I have a hash very similar to the following JSON object; This is only
I found this very short clean code to only allow numeric chars in a
This is a very short question. I have a ParIterable collection and I want
I am very confused. I have this lambda expression: tvPatientPrecriptionsEntities.Sort((p1, p2) => p1.MedicationStartDate .Value
I have this very simple jQuery function: $(.milestone-in-tree).live({ mouseenter: function() { setTimeout( $.ajax({ type:
I have this very simple br2nl function that I use to take a string
I have this very simple example that I am using to learn structs in
I have this very straight forward question regarding Thread and Timer classes in Java
I have this very simple sql statement: SELECT max_dose FROM psychotropes WHERE (patient_meds.psychotrope =
I have this very simple C++ class: class Tree { public: Node *head; };

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.