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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:54:25+00:00 2026-05-28T16:54:25+00:00

I have the following json output from a webservice: [ { subCategories: [ {

  • 0

I have the following json output from a webservice:

[
{
    "subCategories": [
    {
        "subCategories": [],
        "menuItems": [],
        "id": 2,
        "title": "First Course",
        "type": "Menu Section",
        "categoryID": 9,
        "isActive": true,
        "orderIndex": 7
    }, {
        "subCategories": [],
        "menuItems": [
        {
            "id": 0,
            "price": 30,
            "title": "Meat",
            "ingredients": "Bread, Pate, Cilantro, Turkey.",
            "cookingTimeInMinutes": 6,
            "isActive": true,
            "picture": "",
            "categoryID": 3,
            "orderIndex": 2
        }],
        "id": 3,
        "title": "Banh Mi",
        "type": "Food Item",
        "categoryID": 9,
        "isActive": true,
        "orderIndex": 1
    }],
    "menuItems": [
    {
        "id": 1,
        "price": 1,
        "title": "Soup",
        "ingredients": "Water, Good Stuffs, Noodles.",
        "cookingTimeInMinutes": 10,
        "isActive": true,
        "picture": "",
        "categoryID": 9,
        "orderIndex": 4
    }, {
        "id": 3,
        "price": 12,
        "title": "Egg Sandwich",
        "ingredients": "Egg, Sandwich",
        "cookingTimeInMinutes": 6,
        "isActive": true,
        "picture": "",
        "categoryID": 9,
        "orderIndex": 3
    }],
    "id": 9,
    "title": "Lunch",
    "type": "Menu Section",
    "categoryID": null,
    "isActive": true,
    "orderIndex": 0
}, {
    "subCategories": [],
    "menuItems": [],
    "id": 7,
    "title": "Snack",
    "type": "Menu Section",
    "categoryID": null,
    "isActive": true,
    "orderIndex": 8
}, {
    "subCategories": [],
    "menuItems": [],
    "id": 6,
    "title": "First Course",
    "type": "Menu Section",
    "categoryID": null,
    "isActive": true,
    "orderIndex": 5
}, {
    "subCategories": [],
    "menuItems": [
    {
        "id": 2,
        "price": 3,
        "title": "Salad",
        "ingredients": "Veggies",
        "cookingTimeInMinutes": 5,
        "isActive": true,
        "picture": "",
        "categoryID": null,
        "orderIndex": 9
    }],
    "id": -1,
    "title": "Other",
    "type": "Menu Section",
    "categoryID": null,
    "isActive": true,
    "orderIndex": 1000
}]

And I have the following javascript snippet that is supposed to iterate over mentioned json and turn it into divs:

<script type="text/javascript">
    /* wait until the document has finished loading before loading
     * the rest of the content
     */
    $(document).ready(function(){
        function divifyCategory(containerID, gingerWebCategory){
            $('#' + containerID).append(
                $('<div class="category" id="' + gingerWebCategory.id + '">' + gingerWebCategory.title + '</div>')
            );
            for(menuItem in gingerWebCategory.menuItems){
                $('.category#' + gingerWebCategory.id).append(
                    $('<div class="menuItem" id="' + menuItem.id + '">' + menuItem.title + '</div>')
                );
            }
        }

        // load menu from web service
        $.get('http://localhost:50730/GingerWeb.asmx/getMenu', function(data){
            var data = eval(data);
            for(var i=0; i<data.length; i++){
                divifyCategory(data[i]);
            }
        });
    });
</script>

Any idea on why I get this error message in Chrome:

Uncaught Error: Syntax error, unrecognized expression: #[object
Object]

?

  • 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-05-28T16:54:26+00:00Added an answer on May 28, 2026 at 4:54 pm

    Your json object is an array of objects. When you pass data[i], you are passing the first element in the array, an object, and treating it like a string (containerID). You need to get the ID from the object you’re passing.

    • 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 Data, which is a respond from my Webservice. {d:
I have the following json-response from a script: [{title:Welkom bij Pica Plus!,url_title:welkom-bij-pica-plus,entry_id:36,channel_id:1,author_id:6,status:open,entry_date:1336650955000,edit_date:1337180757000,expiration_date:,answer_content:Beste [Leerling],\n\nWelkom bij
I have an json output of the following (ignore the escape characters) {\sEcho\:1,\iTotalRecords\:10,\iTotalDisplayRecords\:10,\aaData\:[{\Job\:\developer\,\Name\:\kurt\},{\Job\:\plumber\,\Name\:\john\}]} which
I have the following JSON String { name:Product, properties: { id: { type:number, description:Product
I have the following JSON string (from wikipedia http://en.wikipedia.org/wiki/JSON ) { name:Product, properties: {
I have the following json returned to me from an API. sections: { 1:
I'm fetching JSON from my ASP .NET website using the following jQuery: $.ajax({ type:
I have the following json object. var json1 = {00 : 00, 15 :
I have the following JSON structure: [{ id:10, class: child-of-9 }, { id: 11,
I have the following json code file named: sections.json { section1: { priority: 1,

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.