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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:53:52+00:00 2026-06-01T17:53:52+00:00

My mobile app reads an external json object. How can I check in javascript

  • 0

My mobile app reads an external json object. How can I check in javascript that a key node exists in the dynamically generated json structure? I tried the hasOwnProperty or containsKey methods, but without luck.

Example json data:

{  "element1": 
  {  "element2": { "Number":  "0" }, 
     "element3": { "Number":  "1" }, 
     "element4": { "Number":  "2" }
  } 
}

As these elements are generated dynamically, I want to check if the key element3 exists in this structure. No luck with data.element1.hasOwnProperty(“element3”).

  • 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-01T17:53:53+00:00Added an answer on June 1, 2026 at 5:53 pm

    Yes, hasOwnProperty() method does not work for a Json object. It works for a Java Script Object. So You just need to convert this Json object into a Java Script Object using eval() method and check inside that object.

    When you convert above Json structure, it will create an Object (element1) inside another Object (say JSObject). element1 will contain properties element2, element3 and element4. So your code should go like this.

    var MyObject={  "element1": 
      {  "element2": { "Number":  "0" }, 
         "element3": { "Number":  "1" }, 
         "element4": { "Number":  "2" }
      } 
    }
    
    var JSObject=eval('(' + MyObject+ ')');
    
    var IsExistElement3 = JSObject.element1.hasOwnProperty("element3");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an mobile app that reads a JSON file that is stored on
I have a windows mobile app (mymobiler) that i am trying to install and
I have a mobile app that is using LinqToDatasets to update/insert into a SQL
I have a mobile app webservice client that connects to a WCF webservice(on my
i'm building a mobile app talking to my symfony2 app via webservices I can't
I'm making a mobile app using phonegap. That is to say, it's all done
I am creating a mobile app using jquery mobile, PHP using JSON for fetching
I have a simple web mobile app that is calculating values in given fields.
I am in mobile app. I have a function that create a dynamic checkbox
I'm experimenting with a jQuery Mobile app that will eventually end up as a

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.