<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to build a dynamic JSON object in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/210168#M42091</link>
    <description>&lt;P&gt;If I rewrite it like this using the chrome add in JSON Editor, I see a List of Associative Arrays&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;[
  {
    "month": 1,
    "month_name": "Jan",
    "albedo": 0.2,
    "soiling_loss": 2
  },
  {
    "month": 2,
    "month_name": "Feb",
    "albedo": 0.2,
    "soiling_loss": 2
  },
  {
    "month": 3,
    "month_name": "Mar",
    "albedo": 0.2,
    "soiling_loss": 2
  },
  {
    "month": 4,
    "month_name": "Apr",
    "albedo": 0.2,
    "soiling_loss": 2
  },
  {
    "month": 5,
    "month_name": "May",
    "albedo": 0.2,
    "soiling_loss": 2
  },
  {
    "month": 6,
    "month_name": "Jun",
    "albedo": 0.2,
    "soiling_loss": 2
  },
  {
    "month": 7,
    "month_name": "Jul",
    "albedo": 0.2,
    "soiling_loss": 2
  },
  {
    "month": 8,
    "month_name": "Aug",
    "albedo": 0.2,
    "soiling_loss": 2
  },
  {
    "month": 9,
    "month_name": "Sep",
    "albedo": 0.2,
    "soiling_loss": 2
  },
  {
    "month": 10,
    "month_name": "Oct",
    "albedo": 0.2,
    "soiling_loss": 2
  },
  {
    "month": 11,
    "month_name": "Nov",
    "albedo": 0.2,
    "soiling_loss": 2
  },
  {
    "month": 12,
    "month_name": "Dec",
    "albedo": 0.2,
    "soiling_loss": 2
  }
]&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2019-05-22 at 2.00.57 PM.png" style="width: 304px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/17367iEE642D23752E3BCF/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2019-05-22 at 2.00.57 PM.png" alt="Screen Shot 2019-05-22 at 2.00.57 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 22 May 2019 18:05:29 GMT</pubDate>
    <dc:creator>bryan_boone</dc:creator>
    <dc:date>2019-05-22T18:05:29Z</dc:date>
    <item>
      <title>How to build a dynamic JSON object</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/208546#M41903</link>
      <description>&lt;P&gt;All,&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; I am wondering how to build a dynamic JSON object in JSL ?&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;request = New HTTP Request(
	url( "http://httpbin.org/post" ),
	Method( "POST" ),
	JSON( "\[{"username":"bob","address":"12345"}]\" )
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Using the example from the scripting index, if I wantedt to vary the username from bob to say mark and address from 12345 to 12346 and I have 10 such calls, I would prefer building that as a dynamic object outside. I initially ventured down the path of building it as an Associative Array and then using the As JSON Expr() , however, that is resulting in an error. My approach in that case was:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;MyAA = Associative Array(); 
MyAA["username"] = "bob" ; 
MyAA["address"] = "12345" ;&lt;BR /&gt;&lt;BR /&gt;request = New HTTP Request(
	url( "http://httpbin.org/post" ),
	Method( "POST" ),
	JSON( As Json Expr(MyAA)) 
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Of course, this is not happening for this example, but the api I am trying to call on. However, when I pass hardcoded JSON as an input, the api call works as expected.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 896px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/17242iCD8011C9634ED134/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Any help is appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2019 02:28:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/208546#M41903</guid>
      <dc:creator>uday_guntupalli</dc:creator>
      <dc:date>2019-05-16T02:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to build a dynamic JSON object</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/208666#M41917</link>
      <description>&lt;P&gt;Have you confirmed that your AS JSON Expr() is the same as your hardcoded?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Building the JSON object seems to be working.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names default to here(1);
MyAA = Associative Array(); 
MyAA["username"] = "bob" ; 
MyAA["address"] = "12345" ;
myAA["aa"] = associative array();
myAA["aa"]["thing1"] = 14;
myAA["aa"]["thing2"] = 28;

show( As JSON Expr(myAA));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 May 2019 17:21:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/208666#M41917</guid>
      <dc:creator>vince_faller</dc:creator>
      <dc:date>2019-05-16T17:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to build a dynamic JSON object</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/208674#M41918</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2610"&gt;@vince_faller&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; As some of the parameters are not something I can share here, I sent it to you as a private message. You will see from the message that the hard-coded example and the As JSON Expr() have the same parameters , the values are dynamic, but it results in an error as I have shown earlier.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2019 18:40:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/208674#M41918</guid>
      <dc:creator>uday_guntupalli</dc:creator>
      <dc:date>2019-05-16T18:40:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to build a dynamic JSON object</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/208830#M41947</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2610"&gt;@vince_faller&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;So the issue is stemming from this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 609px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/17270i258D690AB512EDEE/image-dimensions/609x248?v=v2" width="609" height="248" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the associative array has a key with no value, then upon using the As JSON Expr(), it gets translated to this wierd operator(?) which is not something that can be parsed properly which in turn throws an error. In my case, I just dropped the key from my Associative Array and it worked, however I am curious to know what is the right way to pass such a parameter ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2019 15:23:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/208830#M41947</guid>
      <dc:creator>uday_guntupalli</dc:creator>
      <dc:date>2019-05-17T15:23:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to build a dynamic JSON object</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/208850#M41949</link>
      <description>&lt;P&gt;Can I firstly recommend that you don't just copy a picture, but use the JSL code functionality so people can copy and paste your code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I assume you're trying to give a vector to username?&amp;nbsp;&amp;nbsp;&lt;BR /&gt;I'm still not having it crash with httpbin, though it is still doing the weird operator thing.&amp;nbsp; If I used a list instead of a matrix though it seems to do what I think you want.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names default to here(1);
MyAA = Associative Array();
MyAA["username"] = {1, 2, 3};
MyAA["address"] = "12345";
request = New HTTP Request(
	url( "http://httpbin.org/post" ),
	Method( "POST" ),
	JSON( AsJSONExpr(myAA) )
);
data = request &amp;lt;&amp;lt; Send;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Does that help?&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2019 16:41:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/208850#M41949</guid>
      <dc:creator>vince_faller</dc:creator>
      <dc:date>2019-05-17T16:41:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to build a dynamic JSON object</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/208851#M41950</link>
      <description>&lt;P&gt;You can define any result that you want returned when referring to a key that does not have a value in a pair in an associative array.&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2019 17:08:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/208851#M41950</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2019-05-17T17:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to build a dynamic JSON object</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/208852#M41951</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/5358"&gt;@Mark_Bailey&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; When I use "[ ]" , that results in an error.&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 896px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/17271iB2DB3CB89A2649BF/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2019 17:29:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/208852#M41951</guid>
      <dc:creator>uday_guntupalli</dc:creator>
      <dc:date>2019-05-17T17:29:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to build a dynamic JSON object</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/208878#M41956</link>
      <description>&lt;P&gt;I have not followed this thread at all but saw a mention of the use of associative arrays and what appeared as confusion about the defauilt result. That is the only aspect to which I am replying.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See &lt;STRONG&gt;Help&lt;/STRONG&gt; &amp;gt; &lt;STRONG&gt;Books&lt;/STRONG&gt; &amp;gt; &lt;STRONG&gt;Scripting Guide&lt;/STRONG&gt; and search for associative arrays in the Table of Contents:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Default Values&lt;/STRONG&gt;&lt;BR /&gt;A default value determines the value of a key that does not exist in an associative array. If you&lt;BR /&gt;try to access a key that does not exist in an associative array, an error results. If you define a&lt;BR /&gt;default value for your associative array, accessing a key that does not exist results in the&lt;BR /&gt;following:&lt;BR /&gt;• adds the key to the associative array&lt;BR /&gt;• assigns the default value to the new key&lt;BR /&gt;• returns the new key’s (default) value instead of an error&lt;BR /&gt;If you construct an associative array from a list of strings without assigning values to the keys,&lt;BR /&gt;then the keys are assigned values of 1. The default value for the associative array is set to 0.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;To set the default value:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;cary = Associative Array();
cary &amp;lt;&amp;lt; Set Default Value( "Cary, NC" );&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To determine whether there is a default value set for an associative array, use the &amp;lt;&amp;lt;Get&lt;BR /&gt;Default Value message.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;cary &amp;lt;&amp;lt; Get Default Value;
"Cary, NC"&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;If there is no default value, Empty() is returned.&lt;BR /&gt;Besides the Set Default Value message, a default value can be set in the literal constructor&lt;BR /&gt;using =&amp;gt;value without a key.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;counts = ["a" =&amp;gt; 10,
"b" =&amp;gt; 3,
=&amp;gt; 0]; // default value of 0
counts["c"] += 1;
Show( counts );
counts = ["a" =&amp;gt; 10, "b" =&amp;gt; 3, "c" =&amp;gt; 1, =&amp;gt; 0];&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;In the first line, the default value is set to 0. In the second line, the key "c" does not exist in&lt;BR /&gt;counts. In the output, the key "c" is created with the default value of 0 and then incremented&lt;BR /&gt;by 1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Note: If a key’s value is the default value, then the key&amp;nbsp;is dropped because any key will return&lt;BR /&gt;the default value.&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2019 19:31:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/208878#M41956</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2019-05-17T19:31:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to build a dynamic JSON object</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/209528#M42014</link>
      <description>&lt;P&gt;You can build "dynamic" JSON but you'd have to add your sub-elements to the associative array after they have been created.&lt;/P&gt;
&lt;P&gt;That's just the way JSL works.&lt;/P&gt;
&lt;P&gt;This shows what I mean:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;aa = [=&amp;gt;];
list = {};
aa["a jsl list"] = list;

Insert Into(list, "Hello World");
Insert Into(list, 2019);

show(list);
show(aa);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;outputs:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;list = {"Hello World", 2019};
aa = ["a jsl list" =&amp;gt; {}];&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;While this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;aa = [=&amp;gt;];
list = {};

Insert Into(list, "Hello World");
Insert Into(list, 2019);

aa["a jsl list"] = list;

show(list);
show(aa);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Outputs:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;list = {"Hello World", 2019};
aa = ["a jsl list" =&amp;gt; {"Hello World", 2019}];
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 May 2019 20:44:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/209528#M42014</guid>
      <dc:creator>bryan_boone</dc:creator>
      <dc:date>2019-05-20T20:44:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to build a dynamic JSON object</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/209539#M42016</link>
      <description>&lt;P&gt;The JavaScript/Python syntax for lists ("[]") does not mean the same thing in JSL. In JSL '[]' denotes an empty &lt;EM&gt;matrix, &lt;/EM&gt;which does not a have valid JSON representation, which is why you are getting the '?' operator in the result. That '?' operator in turn must be what is causing the remote error message you are getting as a response from your service.&lt;/P&gt;
&lt;P&gt;You should use instead '{}' to indicate an empty list, or '[=&amp;gt;]' to indicate an empty associative array/dictionary.&lt;/P&gt;
&lt;P&gt;It is always a good practice to capture intermediate results and examine them using show() to test your assumptions.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://wiki.c2.com/?MakeItWorkMakeItRightMakeItFast" target="_blank"&gt;http://wiki.c2.com/?MakeItWorkMakeItRightMakeItFast&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2019 21:07:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/209539#M42016</guid>
      <dc:creator>nascif_jmp</dc:creator>
      <dc:date>2019-05-20T21:07:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to build a dynamic JSON object</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/210149#M42083</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/3734"&gt;@nascif_jmp&lt;/a&gt;&amp;nbsp; and&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/5036"&gt;@bryan_boone&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Thank you for your responses. Your responses helped me get somewhere, however I have a couple of questions:&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Can you kindly provide an example of accepted JSON array format in JSL ? Is this accepted ?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 706px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/17365i94623AB9312F39C4/image-dimensions/706x263?v=v2" width="706" height="263" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;2. Does the scripting index or scripting guide cover the portions on JSON array or how to define an empty JSON object as nasicf has kindly shown ?&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;a. If yes, I would like to read that&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;b. If no, I would request that this be added to the documentation, because I couldn't find it anywhere&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2019 17:52:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/210149#M42083</guid>
      <dc:creator>uday_guntupalli</dc:creator>
      <dc:date>2019-05-22T17:52:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to build a dynamic JSON object</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/210163#M42087</link>
      <description>Do you have the link to the API.  I don't think you've listed valid JSON.&lt;BR /&gt;At least the JSON Editor in Chrome doesn't think so.&lt;BR /&gt;Thanks</description>
      <pubDate>Wed, 22 May 2019 17:52:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/210163#M42087</guid>
      <dc:creator>bryan_boone</dc:creator>
      <dc:date>2019-05-22T17:52:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to build a dynamic JSON object</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/210165#M42089</link>
      <description>&lt;P&gt;Ah.&lt;/P&gt;
&lt;P&gt;I had a transcribing error going from picture to text.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2019 17:57:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/210165#M42089</guid>
      <dc:creator>bryan_boone</dc:creator>
      <dc:date>2019-05-22T17:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to build a dynamic JSON object</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/210167#M42090</link>
      <description>This seems to work. &lt;BR /&gt;innerList = {};&lt;BR /&gt;InsertInto(innerList, [ "month" =&amp;gt; 1, "month_name" =&amp;gt; "Jan", "albedo" =&amp;gt; 0.2, "soiling_loss" =&amp;gt; 2.0]);&lt;BR /&gt;InsertInto(innerList, [ "month" =&amp;gt; 2, "month_name" =&amp;gt; "Feb", "albedo" =&amp;gt; 0.2, "soiling_loss" =&amp;gt; 2.0]);&lt;BR /&gt;InsertInto(innerList, [ "month" =&amp;gt; 3, "month_name" =&amp;gt; "Mar", "albedo" =&amp;gt; 0.2, "soiling_loss" =&amp;gt; 2.0]);&lt;BR /&gt;monthlyFactors = {innerList};&lt;BR /&gt;je = As JSON Expr(EvalList(monthlyFactors)); &lt;BR /&gt;Show(je);&lt;BR /&gt;&lt;BR /&gt;I think the real issue is knowing the right API calls to the JSL list and associative arrays data structures, and their behavior as far as evaluating variables, returning a copy vs a live reference, and so on. The fact that they are being used to build a JSON object is incidental.&lt;BR /&gt;&lt;BR /&gt;Having said that, with the new support for REST APIs from JMP I agree that having a session with a more detailed, end-to-end example would be helpful. I will pass this sugestion alone to our doc team. Thanks for the suggestion!&lt;BR /&gt;</description>
      <pubDate>Wed, 22 May 2019 18:03:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/210167#M42090</guid>
      <dc:creator>nascif_jmp</dc:creator>
      <dc:date>2019-05-22T18:03:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to build a dynamic JSON object</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/210168#M42091</link>
      <description>&lt;P&gt;If I rewrite it like this using the chrome add in JSON Editor, I see a List of Associative Arrays&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;[
  {
    "month": 1,
    "month_name": "Jan",
    "albedo": 0.2,
    "soiling_loss": 2
  },
  {
    "month": 2,
    "month_name": "Feb",
    "albedo": 0.2,
    "soiling_loss": 2
  },
  {
    "month": 3,
    "month_name": "Mar",
    "albedo": 0.2,
    "soiling_loss": 2
  },
  {
    "month": 4,
    "month_name": "Apr",
    "albedo": 0.2,
    "soiling_loss": 2
  },
  {
    "month": 5,
    "month_name": "May",
    "albedo": 0.2,
    "soiling_loss": 2
  },
  {
    "month": 6,
    "month_name": "Jun",
    "albedo": 0.2,
    "soiling_loss": 2
  },
  {
    "month": 7,
    "month_name": "Jul",
    "albedo": 0.2,
    "soiling_loss": 2
  },
  {
    "month": 8,
    "month_name": "Aug",
    "albedo": 0.2,
    "soiling_loss": 2
  },
  {
    "month": 9,
    "month_name": "Sep",
    "albedo": 0.2,
    "soiling_loss": 2
  },
  {
    "month": 10,
    "month_name": "Oct",
    "albedo": 0.2,
    "soiling_loss": 2
  },
  {
    "month": 11,
    "month_name": "Nov",
    "albedo": 0.2,
    "soiling_loss": 2
  },
  {
    "month": 12,
    "month_name": "Dec",
    "albedo": 0.2,
    "soiling_loss": 2
  }
]&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2019-05-22 at 2.00.57 PM.png" style="width: 304px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/17367iEE642D23752E3BCF/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2019-05-22 at 2.00.57 PM.png" alt="Screen Shot 2019-05-22 at 2.00.57 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2019 18:05:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/210168#M42091</guid>
      <dc:creator>bryan_boone</dc:creator>
      <dc:date>2019-05-22T18:05:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to build a dynamic JSON object</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/210169#M42092</link>
      <description>&lt;P&gt;And don't forget you can create JSON by just concatenating strings in the JSON format.&lt;/P&gt;
&lt;P&gt;No Lists or Associative Arrays needed.&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2019 18:07:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/210169#M42092</guid>
      <dc:creator>bryan_boone</dc:creator>
      <dc:date>2019-05-22T18:07:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to build a dynamic JSON object</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/210170#M42093</link>
      <description>That was for building it step by step, the complete "hardcoded" version would be just&lt;BR /&gt;monthlyFactors = { {&lt;BR /&gt; [ "month" =&amp;gt; 1, "month_name" =&amp;gt; "Jan", "albedo" =&amp;gt; 0.2, "soiling_loss" =&amp;gt; 2.0],&lt;BR /&gt; [ "month" =&amp;gt; 2, "month_name" =&amp;gt; "Feb", "albedo" =&amp;gt; 0.2, "soiling_loss" =&amp;gt; 2.0],&lt;BR /&gt; [ "month" =&amp;gt; 3, "month_name" =&amp;gt; "Mar", "albedo" =&amp;gt; 0.2, "soiling_loss" =&amp;gt; 2.0]&lt;BR /&gt;}};&lt;BR /&gt;je = As JSON Expr(monthlyFactors);&lt;BR /&gt;Show(je);&lt;BR /&gt;As a rule of thumb:&lt;BR /&gt;* JSON arrays map to JSL lists (not matrices or vectors, beware of the '[]' similarity);&lt;BR /&gt;* JSON dictionaries map to JSL associative arrays;&lt;BR /&gt;* Check for non-evaluated variable references;&lt;BR /&gt;* Check if data structure modifying calls actually change the target object (as opposed to returning a modified copy).&lt;BR /&gt;</description>
      <pubDate>Wed, 22 May 2019 18:08:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-build-a-dynamic-JSON-object/m-p/210170#M42093</guid>
      <dc:creator>nascif_jmp</dc:creator>
      <dc:date>2019-05-22T18:08:43Z</dc:date>
    </item>
  </channel>
</rss>

