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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:19:11+00:00 2026-06-02T22:19:11+00:00

I have JSON: {status:ok,squares:{3×13:0,3×12:0,4×12:0,2×13:0,4×13:0,4×14:2}} How can i translate this to key-value array in javascript?

  • 0

I have JSON: {"status":"ok","squares":{"3x13":"0","3x12":0,"4x12":0,"2x13":0,"4x13":0,"4x14":2}}

How can i translate this to key-value array in javascript?

        for (var s in s.squares) {
            console.log(s);
        }

gives only keys, like 3×13, 3×12. How get the values?

P.S. Sorry for bad Engish.

  • 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-02T22:19:12+00:00Added an answer on June 2, 2026 at 10:19 pm

    your loop for (var s in s.squares) will iterate each property of the object refered to by s.squares to get the value as well you simply have to do s.squares[s] so the loop would be something like:

    for (var key in s.squares) {
       var value = s.squares[key];
    }
    

    how ever you’d probably want to safe guard yourself a bit and write the itertion like:

    var squares = s.squares;
    for (var key in squares) {
       if(squares.hasOwnProperty(key)){
          var value = squares[key];
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JSON String like this $test='{var1:null,var3:null,status:{code:150,message:blah blah}}'; I want to access the
I have this JSon string received from an AJAX call: {status:OK,addresses:[0,1,2,3,4,5]} To convert it
I have a json file with contents like this: { aaa:{ status:available, classkey:dotnet },
i have a problem with the jquery getjson. This code works $.getJSON('http://twitter.com/status/user_timeline/USERNAME.json?count=10&callback=?', function(twitter_data) {
I have a JSON format like this {response:{status:true,result:user_exists}} Now i am trying to retrieve
I have a json file that looks like this: { status: 200, data: {
I have the following JSON object: { response: { status: 200 }, messages: [
In controller code, I have data in json format data = { 1: {assetId:1,status:true},
I have JSON like this: { something: http://something.com } and HTML like this: <a
I have JSON text that looks like this: { ok: true, totalPages: 256, arReports:

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.