Or, if you have the ID, it is a bit more work:
Main Topics
Browse All TopicsDear Experts,
Continuing on from here:
http://www.experts-exchang
How difficult is it to increase the quantity of an item based on the id if the JSON data is structured as follows?
var cart = [
{
'id':'001',
'name':'Bone',
'price':1.00,
'qty':1
},
{
'id':'010',
'name':'U2',
'price':2.00,
'qty':2
},
{
'id':'011',
'name':'Trio',
'price':3.00,
'qty':3
}
];
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
FYI: For all things JSON, visit http://www.json.org
@narmi2:
There's a major oversight on my part with regards to post ID: 2555153. The array needs to have some valid element. This is NOT a valid element:
'001': {
'name':'Bone',
'price':1.00,
'qty':1
}
The correct syntax for that element is:
{
'001': {
'name':'Bone',
'price':1.00,
'qty':1
}
}
So, essentially you are right back where you started. If you make the corrections, then your structure would be EXACTLY the same as what you posted originally. So, my suggestion would be to use the structure suggested in post ID: 25551400.
>> where "name" is a string enclosed in double-quotes
> and if you try the name/key without the quotes, let me know if javascript errors out for you! :)
To make clear what hielo was hinting at, section 11.1.5 of the ECMAScript standard (http://www.ecma-internati
Follow-up question here:
http://www.experts-exchang
Business Accounts
Answer for Membership
by: BadotzPosted on 2009-10-12 at 05:36:18ID: 25550630
You need the index of the item, then it is trivial:
Select allOpen in new window