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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:42:15+00:00 2026-06-16T02:42:15+00:00

I want to parse the following JSON with JavaScript and then only want to

  • 0

I want to parse the following JSON with JavaScript and then only want to write a specific key type. How can I do that? The simple JSON.parse(output) show me unexpected character error.

output=[{"id":"12","category":"Smartphone","sub_category":"Tablet","name":"Tab 3","current_price":"23000","sold":"9","previous_price":"25000","description":"","image":"galaxy_tab2.jpg"},{"id":"28","category":"Accessories","sub_category":"Ebook","name":"Ebook Acc 3","current_price":"5300","sold":"8","previous_price":null,"description":"","image":"sony.jpg"},{"id":"27","category":"Accessories","sub_category":"ipad","name":"ipad Acc 4","current_price":"1200","sold":"6","previous_price":null,"description":"","image":"scott_ipad.jpg"},{"id":"3","category":"Computer","sub_category":"Laptop","name":"Laptop 3","current_price":"999","sold":"5","previous_price":"1400","description":"","image":"macbook.jpg"},{"id":"20","category":"Smartphone","sub_category":"ipad","name":"ipad 4","current_price":"29000","sold":"5","previous_price":null,"description":"","image":"ipad3.jpg"},{"id":"6","category":"Computer","sub_category":"Laptop","name":"Laptop 6","current_price":"80000","sold":"4","previous_price":"70000","description":"","image":"dell-latitude-e6430s.jpg"},{"id":"8","category":"Computer","sub_category":"Desktop","name":"Desktop 2","current_price":"28000","sold":"4","previous_price":null,"description":"","image":"compaq_pc.jpg"},{"id":"13","category":"Computer","sub_category":"Desktop","name":"Desktop 3","current_price":"29000","sold":"3","previous_price":null,"description":"","image":"gd_d4300.jpg"},{"id":"23","category":"Accessories","sub_category":"PDA","name":"PDA Acc","current_price":"2500","sold":"2","previous_price":"3000","description":"","image":"pda.jpg"},{"id":"24","category":"Accessories","sub_category":"ipad","name":"ipad Acc 3","current_price":"5600","sold":"2","previous_price":null,"description":"","image":"pen_ipad.jpg"},{"id":"1","category":"Computer","sub_category":"Laptop","name":"Laptop 1","current_price":"1199","sold":"0","previous_price":"1400","description":"","image":"macbookpro.jpg"},{"id":"2","category":"Computer","sub_category":"Laptop","name":"Laptop 2","current_price":"1499","sold":"0","previous_price":null,"description":"","image":"macbookair.jpg"},{"id":"4","category":"Computer","sub_category":"Laptop","name":"Laptop 4","current_price":"1000","sold":"0","previous_price":null,"description":"","image":"dell_vostro.jpg"},{"id":"5","category":"Computer","sub_category":"Laptop","name":"Laptop 5","current_price":"40000","sold":"0","previous_price":null,"description":"","image":"vostro_2420.jpg"},{"id":"7","category":"Computer","sub_category":"Desktop","name":"Desktop 1","current_price":"34000","sold":"0","previous_price":null,"description":"","image":"Acer_AX1400.jpg"},{"id":"9","category":"Accessories","sub_category":"Ebook","name":"Ebook Acc 1","current_price":"4000","sold":"0","previous_price":null,"description":"","image":"dragon.jpg"},{"id":"10","category":"Smartphone","sub_category":"Tablet","name":"Tab 1","current_price":"13000","sold":"0","previous_price":null,"description":"","image":"galaxy_tab.jpg"},{"id":"11","category":"Smartphone","sub_category":"Tablet","name":"Tab 2","current_price":"18000","sold":"0","previous_price":null,"description":"","image":"galaxy_tab_2-10.1.jpg"},{"id":"14","category":"Smartphone","sub_category":"ipad","name":"ipad 1","current_price":"20000","sold":"0","previous_price":null,"description":"","image":"hero.jpg"},{"id":"15","category":"Computer","sub_category":"Desktop","name":"Desktop 4","current_price":"25000","sold":"0","previous_price":null,"description":"","image":"hp_desktop.jpg"},{"id":"16","category":"Accessories","sub_category":"Ebook","name":"Ebook Acc 2","current_price":"3000","sold":"0","previous_price":null,"description":"","image":"IES1.jpg"},{"id":"17","category":"Accessories","sub_category":"ipad","name":"ipad Acc 2","current_price":"5000","sold":"0","previous_price":null,"description":"","image":"iluv-ipad.jpg"},{"id":"18","category":"Smartphone","sub_category":"ipad","name":"ipad 2","current_price":"30000","sold":"0","previous_price":null,"description":"","image":"ipad_mini.jpg"},{"id":"19","category":"Smartphone","sub_category":"ipad","name":"ipad 3","current_price":"25000","sold":"0","previous_price":null,"description":"","image":"ipad2.jpg"},{"id":"21","category":"Computer","sub_category":"Desktop","name":"Desktop 5","current_price":"36000","sold":"0","previous_price":null,"description":"","image":"lenovo_k210.jpg"},{"id":"22","category":"Computer","sub_category":"Desktop","name":"Desktop 6","current_price":"28500","sold":"0","previous_price":null,"description":"","image":"Lm_i501s.jpg"},{"id":"25","category":"Smartphone","sub_category":"Tablet","name":"Tab 4","current_price":"21000","sold":"0","previous_price":null,"description":"","image":"samsung_tab.jpg"},{"id":"26","category":"Smartphone","sub_category":"Tablet","name":"Tab 5","current_price":"23900","sold":"0","previous_price":null,"description":"","image":"samsung_tablet.jpg"},{"id":"29","category":"Accessories","sub_category":"Tablet","name":"Tab Acc 1","current_price":"4300","sold":"0","previous_price":null,"description":"","image":"tablet_kit.jpg"},{"id":"30","category":"Accessories","sub_category":"","name":"Tab Acc 2","current_price":"3600","sold":"0","previous_price":null,"description":"","image":"toshiba_tab.jpg"},{"id":"31","category":"Computer","sub_category":"Laptop","name":"Laptop 6","current_price":"42000","sold":"0","previous_price":null,"description":"","image":"vostro_2420.jpg"}]
  • 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-16T02:42:16+00:00Added an answer on June 16, 2026 at 2:42 am

    There is no need to call JSON.parse() on the array you have in output, as it is not a string. It is merely an array of objects which you can loop over to access the key you want.

    // This is *already* a valid JavaScript array of objects. There's no need to treat it like a JSON string.
    var output = [{"id":"12","category":"Smartphone","sub_category":"Tablet","name":"Tab 3","current_price":"23000","sold":"9","previous_price":"25000","description":"","image":"galaxy_tab2.jpg"},{"id":"31","category":"Computer","sub_category":"Laptop","name":"Laptop 6","current_price":"42000","sold":"0","previous_price":null,"description":"","image":"vostro_2420.jpg"}]
    
    // Just loop over the array and access the object property you want
    // For example:
    for (var i = 0; i < output.length; i++) {
      // Log the category of each element...
      console.log(output[i].category);
      // Or... output[i].description, output[i].image, etc...;
    }
    
    // Outputs something like:
    Smartphone 
    Accessories
    Computer
    Smartphone
    Computer
    Accessories
    Computer
    Accessories
    Smartphone
    Computer
    Accessories
    Smartphone
    Computer
    Smartphone
    Accessories
    Computer
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following JSON Object: [{id:123,username:test}] I want to parse username using javascript
I can parse the simple JSON string using the following code HttpClient client =
I have the following JSON that I want to parse into C#. I am
I just want to parse the following string up until the END token then
I have XML in the following form that I want to parse with PHP
I want to parse the following JSON response. I couldn't extract the JSONArray which
I want to parse the following Json file in Java. But I am not
I want to parse following JSON using Titanium Appcelerator Mobile SDK [{City:null,Distance:469,Email:null,Latitude:0,Longitude:0,Name:Cretin-Derham Hall,PhoneNo:null,SchoolId:75,State:null,Zip:null},{City:null,Distance:213,Email:null,Latitude:0,Longitude:0,Name:East Ridge,PhoneNo:null,SchoolId:76,State:null,Zip:null},{City:null,Distance:26,Email:null,Latitude:0,Longitude:0,Name:Hastings,PhoneNo:null,SchoolId:78,State:null,Zip:null},{City:null,Distance:116,Email:null,Latitude:0,Longitude:0,Name:Stillwater,PhoneNo:null,SchoolId:81,State:null,Zip:null},{City:null,Distance:0,Email:null,Latitude:0,Longitude:0,Name:White
I want to parse a JSON file in java and get the following values
I want to parse the following XML document to resolve all entities in it:

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.