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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:15:27+00:00 2026-05-23T01:15:27+00:00

I have the following JSON file as input, { $type: NanoWebInterpreter.WebInputData, NanoWebInterpreter, NBBList: {

  • 0

I have the following JSON file as input,

{
  "$type": "NanoWebInterpreter.WebInputData, NanoWebInterpreter",
  "NBBList": {
    "$type": "System.Collections.Generic.List`1[[monoTNP.Common.NBB, monoTNP.Common]], mscorlib",
    "$values": [
      {
        "$type": "monoTNP.Common.NBB, monoTNP.Common",
        "ID": "id-0065-00000003",
        "MPList": {
          "$type": "System.Collections.Generic.List`1[[monoTNP.Common.MP, monoTNP.Common]], mscorlib",
          "$values": [
            {
              "$type": "monoTNP.Common.EllipticalMP, monoTNP.Common",
              "Eccentricity": 1.0,
              "ID": "id-0065-00000006",
              "ParticleIndex": -1,
              "DispersionInteractionStrength": 0.0,
              "DispersionInteractionRange": 2.5,
              "CharacteristicSize": 0.0,
              "CenterOfMass": "<0,0,0>",
              "OrientationVector": "<>"
            },
            {
              "$type": "monoTNP.Common.CubeMP, monoTNP.Common",
              "ID": "id-0065-00000005",
              "ParticleIndex": -1,
              "DispersionInteractionStrength": 0.0,
              "DispersionInteractionRange": 2.5,
              "CharacteristicSize": 0.0,
              "CenterOfMass": "<0,0,0>",
              "OrientationVector": "<>"
            },
            {
              "$type": "monoTNP.Common.CircularMP, monoTNP.Common",
              "ID": "id-0065-00000004",
              "ParticleIndex": -1,
              "DispersionInteractionStrength": 0.0,
              "DispersionInteractionRange": 2.5,
              "CharacteristicSize": 0.0,
              "CenterOfMass": "<0,0,0>",
              "OrientationVector": "<>"
            }
          ]
        },

etc.

My ultimate goal is to trace this tree recursively, wrapping each key/object name with <ul> tags, and the properties at the “ParticleIndex” level in some kind of <form> structure, but I can’t figure out how to index into the two ‘$values’ arrays.

This is the code that I have been manipulating to learn how each element(object or array) is accessed:

foreach ($json->NBBList->'$values'[0] as $key => $value){
    var_dump($key);
    echo "\n".var_dump($value);
    echo "\n\n\n";
}

This obviously doesn’t work because the index of values is outside of the string, but when it is on the inside, PHP interprets it as part of the string.

Is there a way for me to index into each element of the ‘$values’ array, and ultimately in a for loop?

I’m thinking using the “true” property of JSON decode might be a better solution…

  • 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-23T01:15:28+00:00Added an answer on May 23, 2026 at 1:15 am

    You can access object properties with names that contain special characters using this notation:

    $json->NBBList->{'$values'}[0]
    

    I don’t think that this behavior is documented anywhere, but you can find it in the PHP grammar (see definition of variable_name, which is used in object_dim_list, which is used in object_property).

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

Sidebar

Related Questions

I have the following javascript: $.ajax({ type: "POST", dataType: "json", url: "/Home/Submit", data: {
I have the following json code file named: sections.json { section1: { priority: 1,
I have a configuration file in the following JSON format: { key1: value1, key2:
I have the following json file: { segments: { externalId: 123, name: Tomas Zulberti,
I have following json file. { id: 100001740605903, name: Mike Watshan, first_name: Mike, last_name:
say I have the following json object; {'fname':'john', 'lname':'Locke'} and the following text boxes
I basically have the following flow: XML -> JSON -> Spring MVC -> jsp
I have following foreach-loop: using System.IO; //... if (Directory.Exists(path)) { foreach(string strFile in Directory.GetFiles(path,
I have following text in a file 23456789 When I tried to replace the
I have the following JSON: { nickname: xadoc, level: 4, loc: Tulsa, OK, USA,

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.