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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:56:00+00:00 2026-05-30T23:56:00+00:00

What is the difrence between: s1 = ‘[a]’ s2 = [‘a’] When I do

  • 0

What is the difrence between:

  1. s1 = '["a"]'

  2. s2 = "['a']"

When I do json.loads, I get following error for s2 but s1 is fine:

>>> s1='["a2"]'
>>> s2="['a2']"
>>> json.loads(s1)
[u'a2']
>>> json.loads(s2)
 raise ValueError("No JSON object could be decoded")
 ValueError: No JSON object could be decoded
  • 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-30T23:56:01+00:00Added an answer on May 30, 2026 at 11:56 pm

    The problem is JSON uses double quotes (") for quoting values, not single ones (').

    Which means the exception is thrown because of invalid JSON:

    • this is invalid JSON: ['a']
    • this is valid JSON: ["a"]

    Also the correct example is below, different than yours:

    >>> import json
    >>> s1 = "['a']"
    >>> s2 = '["a"]'
    >>> json.loads(s1)
    ... some traceback removed ...
    ValueError: No JSON object could be decoded
    >>> json.loads(s2)
    [u'a']
    

    EDIT: I have updated the question with the correct output OP must have seen instead of what he/she posted (json.loads('["a2"]') was not throwing errors, json.loads("['a2']") was).

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

Sidebar

Related Questions

getting started with osgi, i wonder what's the conceptual diffence between bundles and components.
What is core difference between Java for Google App Engine and Java EE? (I
How to get number range in java? for instance how can verify is the
In Firefox console, this code will generate error: {d : [bankaccountnumber, $1234.56] } >
What is the diffrence between a unique index and a unique key?
I'm new to EJB, and I'm trying to understand the diference between Stateless and
In php, to connect to MSSQL server , what is diffrence between odb_connect() and
What is the diference between those two examples of code? public Test(int x) {
i have the following code: foreach (var str in usedCSS) { if (CSS.Contains(str)) Response.Write(str);
What is the practical diference between these two: <xs:element name=A> <xs:complexType mixed=true> <xs:attribute name=att

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.