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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:33:59+00:00 2026-06-18T11:33:59+00:00

Note that this is an actual Javascript object, whereas JSON is a string that

  • 0

Note that this is an actual Javascript object, whereas
JSON is a string that represents that object.

JSONExample = {
"frames": {
    "chaingun.png": {
        "frame": {
            "x": 1766,
            "y": 202,
            "w": 42,
            "h": 34
        },
        "rotated": false,
        "trimmed": true,
        "spriteSourceSize": {
            "x": 38,
            "y": 32,
            "w": 42,
            "h": 34
        },
        "sourceSize": {
            "w": 128,
            "h": 128
        }
    },
    "chaingun_impact.png": {
        "frame": {
            "x":1162,
            "y":322,
            "w":38,
            "h":34},
        "rotated": false,
        "trimmed": true,
        "spriteSourceSize": {
            "x":110,
            "y":111,
            "w":38,
            "h":34},
        "sourceSize": {
            "w":256,
            "h":256}
    },
    "chaingun_impact_0000.png": {
        "frame": {
            "x": 494,
            "y": 260,
            "w": 22,
            "h": 22
        },
        "rotated": false,
        "trimmed": true,
        "spriteSourceSize": {
            "x": 113,
            "y": 108,
            "w": 22,
            "h": 22
        },
        "sourceSize": {
            "w": 256,
            "h": 256
        }
    }
}
};

The above is an example of how the JSON would be structured.
Note that chaingun_impact.png is not here, we’ll call your
parseJSON function with the full JSON input.

parseJSON = function (weaponJSON) {
 // Your Code here 

};

I want to grab the ‘x’ data field within ‘spriteSourceSize’ of ‘chaingun_impact.png’ .

Thanks in advace

Edit

and this is what i tried but it doesn’t work

var parsedjson =  JSON.parse(weaponJSON);
alert(parsedjson);
console.log(pardesjson);
var x = parsedjson ['frames']['chaingun_impact.png']['spriteSourceSize'][x];
console.log(x);
  • 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-18T11:34:00+00:00Added an answer on June 18, 2026 at 11:34 am

    Use parsedjson['frames']['chaingun_impact.png']['spriteSourceSize']['x'];

    The 'x' also needs quotes.

    You could also do it this way:

    parsedjson.frames['chaingun_impact.png'].spriteSourceSize.x;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

(note that this question is not about CAS, it's about the May fail spuriously
Note that this is for an ApiController in MVC 4 although I think it
Warning: Note that this is a dumb question of something that I would probably
[Please note that this is a different question from the already answered How to
Please note that this is not homework and i did search before starting this
Please note that this question is from 2008 and now is of only historic
I want to note that this is COMPLETELY a made up question. I am
Does .NET Transliteration library exists ? Note that this is not translation, something like
Note: I realize that this is probably an open-ended question, so go ahead and
Please note that I did ask this on Super User and received absolutely no

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.