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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:04:48+00:00 2026-05-25T23:04:48+00:00

I try to parse json string using this method: QString ourJSONData = QString(‘{couchdb:Welcome,version:1.0.1}’); QString

  • 0

I try to parse json string using this method:

QString ourJSONData = QString('{"couchdb":"Welcome","version":"1.0.1"}');
QString response = QString("[") + QString(ourJSONData) + QString("]");

QScriptEngine engine;
QScriptValue sc = engine.evaluate(response);

ui->label->setText(sc.toString());

But label return

SyntaxError: Parse error

I using Qt 4.7.4

What i do wrong? Thanks.

UPD:

Sorry, problem was in that string:

QString ourJSONData = QString(‘{“couchdb”:”Welcome”,”version”:”1.0.1″}’);

need change to:

QString ourJSONData = QString(“{\”couchdb\”:\”Welcome\”,\”version\”:\”1.0.1\”}”);

P.S. this method i found at http://blog.siegerstein.com/archives/134

  • 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-25T23:04:49+00:00Added an answer on May 25, 2026 at 11:04 pm

    I built your code in QtCreator in got a very helpful error message:

    character constant too long for its type

    It’s because your ourJSONData variable is initialised with a text in single quotes, which is for single characters.

    This will correct that initialisation. (I put a \ before each double-quote, and then changed the single-quotes to double):

    QString ourJSONData = QString("{\"couchdb\":\"Welcome\",\"version\":\"1.0.1\"}");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to get parse JSON response for the following link: https://graph.facebook.com/feed/?ids=135395949809348,149531474996&access_token= The response
I'm trying to parse JSON string using Boost Spirit store JSON object into recursive
Receiving this error (JSON.parse: unexpected character) when I try to parse a JSON validated
I'm try to parse this xml, but c# keeps throwing an exception saying it
I'm trying to parse a webpage using Java with URLConnection. I try to set
I'm implementing a TryParse(string s, Out object result) method. If the parse fails, I
I'm using JQuery to call a PHP function that returns a JSON string upon
When I call this constructor to parse some JSON I'm getting a nullpointer exception
I am creating a JSON string using James Newton-King's excellent JSON libary. I create
I'm using ajax to make a request on a servletand receive json String servlet

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.