---
title: "How do query json for a value?"  
description: "How do query json for a value?"  
author: "Mark Devid"  
published: 2013-03-12  
updated: 2013-03-12  
canonical: https://www.mindstick.com/forum/657/how-do-query-json-for-a-value  
category: "javascript"  
tags: ["javascript"]  
reading_time: 1 minute  

---

# How do query json for a value?

Hi!

How do I find out which "[count](https://www.mindstick.com/forum/157774/selecting-count-with-distinct)"-id the loaded [picture](https://answers.mindstick.com/qa/38554/name-the-oscar-winning-sound-designer-who-became-the-first-asian-to-win-the-award-for-best-sound-for-documentary-india-s-daughter-at-the-coveted-motion-picture-sound-editors-63rd-annual-golden-reel-awards) has?

The loaded picture is: "df5ddc27f7569f83e3867bec71a2cac0.jpg"\
And my [json](https://www.mindstick.com/forum/34446/convert-json-string-to-object) are:

[\
{"count":1,"[file](https://www.mindstick.com/articles/59/encrypting-and-decrypting-files-using-c-sharp)":"8b6c5592f0378dc8c56e591a7b147826.jpg"},\
{"count":2,"file":"a44618c1afe93be486382ceb38536e02.jpg"},\
{"count":3,"file":"3c692942d69fba0d16971e0685f42757.jpg"},\
{"count":4,"file":"df5ddc27f7569f83e3867bec71a2cac0.jpg"}\
]

Has anybody an idea for me?

Thanks in [advance](https://www.mindstick.com/blog/33258/jee-mains-and-jee-advance-exams)!

## Replies

### Reply by AVADHESH PATEL

Hi Mark!

I assume that you are trying to do this with JavaScript

var jsondata = [\
{"count":1,"file":"8b6c5592f0378dc8c56e591a7b147826.jpg"},\
{"count":2,"file":"a44618c1afe93be486382ceb38536e02.jpg"},\
{"count":3,"file":"3c692942d69fba0d16971e0685f42757.jpg"},\
{"count":4,"file":"df5ddc27f7569f83e3867bec71a2cac0.jpg"}\
];

function getId(file) {\
for(var f in jsondata) {\
if(jsondata[f].file == file)\
return jsondata[f].count;\
}\
}

var id = getId("df5ddc27f7569f83e3867bec71a2cac0.jpg"); //count-id


---

Original Source: https://www.mindstick.com/forum/657/how-do-query-json-for-a-value

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
