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

  • Home
  • SEARCH
  • 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 7610423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:24:55+00:00 2026-05-31T01:24:55+00:00

I have a simple JSON object graph I’m trying to render using a Mustache

  • 0

I have a simple JSON object graph I’m trying to render using a Mustache template in an ASP.NET MVC 3 site using Nustache (Nustache.Core and Nustache.Mvc).

My object graph represents a simple list of Franchises, each has one or more owners (if active and operating) and each owner contains a Name object with First, Last, Middle, Suffix, Title:

{
  "Count": 39,
  "Franchises": [
    {
      "Id": "81e5e91b-37eb-4f60-ac5f-d2d9a2c1b8fc",
      "Name": "My Franchise, Inc.",
      "Number": "001",
      "Owners": [],
      "Status": {
        "Id": 4,
        "Name": "Terminated"
      }
    },
    {
      "Id": "98887526-5b1d-4db9-9ddb-2be2cd6af957",
      "Name": "My Other Franchise, Inc.",
      "Number": "0002",
      "Owners": [
        {
          "Id": "cffd8de3-aa12-4dbf-b129-0886aea7d1b1",
          "Name": {
            "FirstName": "James",
            "LastName": "Drew",
            "MiddleName": null,
            "Suffix": null,
            "Title": null
          }
        }
      ],
      "Status": {
        "Id": 2,
        "Name": "Operating"
      }
    }.
    ...
  ]
}

My MVC action method is very simple. Uses a WebClient to grab the JSON from the service and the JavaScriptSerializer to convert the JSON to a dictionary and passes that to the view:

public ActionResult Index()
{
    var json = null as String;
    var serializer = new System.Web.Script.Serialization.JavaScriptSerializer();

    using (var client = new System.Net.WebClient())
    {
        json = client.DownloadString(@"http://my.service.com/franchises");
    }

    return PartialView(serializer.Deserialize<Dictionary<string, object>>(json));
}

And here is my basic Mustache template:

<ul>
  {{#Franchises}}
    <li><a id="{{Id}}" href="/franchises/details/{{Id}}">{{Number}}</a>
      {{#Owners}}
        TODO: Print Name Here
      {{/Owners}}
    </li>
  {{/Franchises}}
</ul>

The problem I’m having is printing the name of each owner. The template renders everything but the owner’s name and I’ve tried several template variations with no luck; replacing TODO: Print Name Here with:

  • {{Name}} prints out System.Collections.Generic.Dictionary'2[System.String,System.Object]
    for each owner object

  • {{#Name}}{{FirstName}} {{LastName}}{{/Name}} prints blank

  • {{> Name}} that points to a template with {{#Name}}{{FirstName}} {{LastName}}{{/Name}} or {{FirstName}} {{LastName}} both print blank

  • Both {{Name.FirstName}} or {{Name/FirstName}} print blank

I don’t know what else to try. It can’t be this difficult to navigate through an object graph. Can someone please let me know what I’m doing wrong?

  • 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-31T01:24:56+00:00Added an answer on May 31, 2026 at 1:24 am

    The problems I’m having are definitely within Nustache as pointed out by Gazler in the comments. Unfortunately, I can’t seem to find any other implementations of Mustache in .NET so I’ll probably have to roll my own (or at least add to Nustache) to enable the expected functionality.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple class in asp.net mvc that looks like this: public class
I'm using java, json.simple.JSONObject. I have a json object inside which I have a
I have an extremely simple JSON object that looks like the following: var data
I have a simple object that is deserialized from JSON into a server-side object.
I have simple resource which should return JSON array, but it returns object in
So I have a class that I was planning on using for simple JSON
I have a simple json parsed object that sometimes has a variable tt defined
I'm doing pretty simple thing here: getting Facebook news feed using their graph API.
As a response to a POST, the server returns very simple JSON object that
Hi I am trying to use Json Simple to select the cheese entry, however

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.