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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:12:28+00:00 2026-06-07T09:12:28+00:00

So I have this really large object that I use to control things in

  • 0

So I have this really large object that I use to control things in a nodejs app. Occasionally I store this object in a database [mysql] so if the process crashes or gets restarted and something’s been changed, the changes will be saved. Pretty simple.

The object is this: http://snippi.com/s/z5nq0v5

it’s defined as global.config.

So to store, I use my save function:

    client.query('SELECT data FROM settings WHERE (id = \''+ config.room +'\')',
        function(a, b, c) {
            if (!b[0]) {
                client.query('INSERT INTO settings (id, data) VALUES (?, ?)', [config.room, JSON.stringify(config)],
                    function (a) { if (a) throw a;Log("Saved settings"); }
                );
            } else {
                client.query('UPDATE settings SET data="?" WHERE id="'+config.room+'"',
                    [JSON.stringify(config)],
                function (a) { if (a) throw a;Log("Saved settings"); }
            );
            }
        }
    );

and that seems to work. However, when I try to load it after I change something, and it saves,
I get an error. This is the loading code:

    client.query('SELECT data FROM settings WHERE (id = \''+ config.room +'\')',
        function(a, b, c) {
            console.log(b.length);
            if (a) return console.log(a);
            if (!b[0]) return db.save("settings");
            console.log(b[0].data);
            config = JSON.parse(b[0].data);
            Log("Loaded Settings");
        }
    );

As you can see, all I’m really doing is calling JSON.parse() of the object I just stringified earlier. Yet I’m getting an error. The error is

undefined:1
3Th0seB310W","ui
^
SyntaxError: Unexpected token '

but there isn’t a ‘ in the area where it’s talking about. If you refer to the object up there.

These are the results form console.log(b[0].data): http://snippi.com/s/tknlgyo

Any help would be appreciated, and I’ll add more info if it’s needed.
Note: the auth code has obviously been changed, but it’s just a hex value like the uid below it, just longer.

  • 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-07T09:12:30+00:00Added an answer on June 7, 2026 at 9:12 am

    The output of console.log has single quotes. That means the string you are trying to parse has them. Strip them before parsing.

    For example, here is a a session using node:

    > console.log("abc")
    abc
    

    The snippet you posted showed the single quotes. node did not put them there, so they must have gotten in your data somehow earlier. Make sure to suppress those when you generate and store your string.

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

Sidebar

Related Questions

Ok I have this problem that I've never had before, it's really bugging me.
I have read that you can do it, but would this really improve performance
This is really getting to me now.I have a form that loads when the
So I have this Java program that I use to munch through several terabytes
I have found this answer really useful. It helps me plot network/graphs and select
hey guys having this really simple problem but cant seem to figure out have
I have this case <WrapPanel> <CheckBox>Really long name</CheckBox> <CheckBox>Short</CheckBox> <CheckBox>Longer again</CheckBox> <CheckBox>Foo</CheckBox> <Slider MinWidth=200
this seems to be weird but it really happened. I have this code working
Really quick jQuery question... I have this function: $(document).ready(function() { $('a#show1').click(function() { $('.item1').toggle(1000); return
I have really no idea why I'm asking this as this a really completely

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.