title: c# to geojson popup items bracketing []
body: <p>I have a database of GPS coordinates and information about trucks and I’m trying to build a map with that information using GeoJson. I collect the information using MYSQL and I’m creating the GeoJson file in c#. I can create the correct GeoJson file to show the location, heading and a small popup. However; I want to expand that popup. I’ll be using 1 truck in the examples for simplification. I also changed the coordinates for this example.</p>
  
  <p>My C# output;</p>
  
  <pre><code>{
    "type":"FeatureCollection",
    "features":[
      {
        "type":"Feature",
        "properties":{
          "popup":{
            "title":"Truck_001",
            "subtitle":"Laatst geupdate: 23.1500 uur geleden.",
            "imageUrl":"&lt;left blank for stacksocial&gt;",
            "items":{
              "type":"text",
              "label":"text",
              "value":"text items"
            }
          },
          "tooltip":"Laatst geupdate: 23.1500 uur geleden.",
          "marker":{
            "prefix":"fa",
            "icon":"fa-chevron-up",
            "markerColor":"#003da5",
            "iconColor":"white",
            "square":false,
            "circle":false,
            "pureIcon":false,
            "layer":"layer1",
            "size":"medium"
          }
        },
        "geometry":{
          "type":"Point",
          "coordinates":[
            1.981588,
            32.1926765
          ]
        }
      }
    ]
  }
  </code></pre>
  
  <p>The truck will show on the map, but the items will not be shown due to missing the following brackets: ‘[]’</p>
  
  <p>The desired output (see ‘[‘ and ‘]’ around the item):</p>
  
  <pre><code>{
    "type":"FeatureCollection",
    "features":[
      {
        "type":"Feature",
        "properties":{
          "popup":{
            "title":"Truck_001",
            "subtitle":"Laatst geupdate: 23.1500 uur geleden.",
            "imageUrl":"&lt;left blank for stacksocial&gt;",
            "items":[ /*HERE*/
              {
                "type":"text",
                "label":"text",
                "value":"text items"
              }
            ] /* HERE */
          },
          "tooltip":"Laatst geupdate: 23.1500 uur geleden.",
          "marker":{
            "prefix":"fa",
            "icon":"fa-chevron-up",
            "markerColor":"#003da5",
            "iconColor":"white",
            "square":false,
            "circle":false,
            "pureIcon":false,
            "layer":"layer1",
            "size":"medium"
          }
        },
        "geometry":{
          "type":"Point",
          "coordinates":[
            1.981588,
            32.1926765
          ]
        }
      }
    ]
  }
  </code></pre>
  
  <p>My C# Code:</p>
  
  <pre><code>public class Marker
  {
      public string prefix;
      public string icon;
      public string markerColor;
      public string iconColor;
      public bool square;
      public bool circle;
      public bool pureIcon;
      public string layer;
      public string size;
  }
  
  public class Popup
  {
      public string title;
      public string subtitle;
      public string imageUrl;
      public Items items;
  }
  
  public class Items
  {
      public string type;
      public string label;
      public string value;
  }
  
  public class Properties
  {
      public Popup popup;
      public string tooltip;
      public Marker marker;
  }
  
  public class Geometry
  {
      public string type;
      public double[] coordinates;
  }
  
  public class Feature
  {
      public string type;
      public Properties properties;
      public Geometry geometry;
  }
  
  public class GeoJSON
  {
      public string type;
      public List&lt;Feature&gt; features;
  }
  
  public class SinglePosition
  {
      public string headingicon;
      public string ts;
      public string Lastupdate;
      public string ticksts;
      public string ticksnow;
      public double lat;
      public double lng;
      public int heading;
      public string devId;
      public int heading1;
  }
  
  public static object[] Evaluate(object[] input)
  {
      string dbres = input[0].ToString();
  
      var allPositions = dbres.FromJSON&lt;SinglePosition[]&gt;();
      if (allPositions == null || allPositions.Length == 0)
          return null;
  
      var toMap = new GeoJSON() { type = "FeatureCollection", features = new List&lt;Feature&gt;() };
  
      foreach (var p in allPositions)
      {
          if ((p.heading &gt; 315) || (p.heading &lt;= 45))
          {
              p.headingicon = "fa-chevron-up";
          }
          else if ((p.heading &gt; 45) &amp;&amp; (p.heading &lt;= 135))
          {
              p.headingicon = "fa-chevron-right";
          }
          else if ((p.heading &gt; 135) &amp;&amp; (p.heading &lt;= 225))
          {
              p.headingicon = "fa-chevron-down";
          }
          else if ((p.heading &gt; 225) &amp;&amp; (p.heading &lt;= 315))
          {
              p.headingicon = "fa-chevron-left";
          }
          else
          {
              p.headingicon = "fa-car";
          }
          toMap.features.Add(new Feature()
          {
              type = "Feature",
              properties = new Properties()
              {
                  popup = new Popup()
                  {
                      title = p.devId,
                      subtitle = "Laatst geupdate: " + p.Lastupdate + " uur geleden.",
                      imageUrl = "&lt;URL&gt;",
  
                      items = new Items()
                      //[
                      {
                          type = "text",
                          label = "text",
                          value = "text items"
                      }
                      //]
                  },
                  tooltip = "Laatst geupdate: " + p.Lastupdate + " uur geleden.",
                  marker = new Marker()
                  {
                      prefix = "fa", // glyphicon or fa
                      icon = p.headingicon,
                      markerColor = "#003da5",
                      iconColor = "white",  // #b60055
                      square = false,
                      circle = false,
                      pureIcon = false,
                      layer = "layer1",
                      size = "medium"
                  }
              },
              geometry = new Geometry()
              {
                  type = "Point",
                  coordinates = new double[] { p.lng, p.lat }
              }
          });
      }
  
      return new object[] { toMap.ToJSON() };
  }
  </code></pre>
  
  <p>I have read online that those ‘[]’ brackets are attributes, but I have no idea how to use them. How could I use them in my code so that the class items uses them?</p>