<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.secondlife.com/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Reconx86+Resident</id>
	<title>Second Life Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.secondlife.com/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Reconx86+Resident"/>
	<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/wiki/Special:Contributions/Reconx86_Resident"/>
	<updated>2026-07-28T11:03:12Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LlRequestSimulatorData&amp;diff=1200446</id>
		<title>LlRequestSimulatorData</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LlRequestSimulatorData&amp;diff=1200446"/>
		<updated>2016-06-12T11:03:14Z</updated>

		<summary type="html">&lt;p&gt;Reconx86 Resident: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL_Function&lt;br /&gt;
|inject-2={{Issues/SVC-2596}}{{Issues/SVC-4921}}{{Issues/BUG-5031}}&lt;br /&gt;
|func_id=293|func_sleep=1.0|func_energy=10.0&lt;br /&gt;
|func=llRequestSimulatorData&lt;br /&gt;
|return_type=key&lt;br /&gt;
|return_subtype=handle&lt;br /&gt;
|p1_type=string|p1_name=region|p1_desc=Case sensitive region name.&lt;br /&gt;
|p2_type=integer|p2_name=data|p2_desc=DATA_* flag&lt;br /&gt;
|func_footnote&lt;br /&gt;
|func_desc=Requests {{LSLP|data}} about {{LSLP|region}}. When {{LSLP|data}} is available the {{LSLG|dataserver}} event will be raised.&lt;br /&gt;
|return_text=for a {{LSLG|dataserver}} event response.&lt;br /&gt;
|spec&lt;br /&gt;
|caveats=&lt;br /&gt;
*There is no DATA_SIM_TYPE or DATA_SIM_MAXPRIMS flags. [[#SVC-4921|SVC-4921]]&lt;br /&gt;
|constants={{{!}} {{Prettytable|style=margin-top:0;}}&lt;br /&gt;
{{!}}- {{Hl2}}&lt;br /&gt;
! colspan=&amp;quot;2&amp;quot; {{!}} {{LSL Param|data}} Constant&lt;br /&gt;
! Type&lt;br /&gt;
! colspan=&amp;quot;4&amp;quot; {{!}} Description&lt;br /&gt;
{{!}}-&lt;br /&gt;
{{LSL_Constants/llRequestedSimulatorData}}&lt;br /&gt;
{{!}}}&lt;br /&gt;
|examples=Hide objects in PG or unknown regions&lt;br /&gt;
&amp;lt;source lang=&amp;quot;lsl2&amp;quot;&amp;gt;&lt;br /&gt;
key         gRateingQuery       =   NULL_KEY        ;&lt;br /&gt;
&lt;br /&gt;
show()&lt;br /&gt;
{&lt;br /&gt;
    llSetLinkAlpha( LINK_SET, 1.0, ALL_SIDES );&lt;br /&gt;
}//show&lt;br /&gt;
&lt;br /&gt;
hide()&lt;br /&gt;
{&lt;br /&gt;
     llSetLinkAlpha( LINK_SET, 0.0, ALL_SIDES );&lt;br /&gt;
}//hide&lt;br /&gt;
&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    on_rez(integer Setting)&lt;br /&gt;
    {&lt;br /&gt;
        llResetScript();&lt;br /&gt;
    }//on_rez&lt;br /&gt;
    &lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        gRateingQuery = llRequestSimulatorData( llGetRegionName(), DATA_SIM_RATING );&lt;br /&gt;
    }//state_entry&lt;br /&gt;
   &lt;br /&gt;
    changed(integer ItChanged)&lt;br /&gt;
    {&lt;br /&gt;
        if (ItChanged &amp;amp; CHANGED_OWNER)      llResetScript();&lt;br /&gt;
        if (ItChanged &amp;amp; CHANGED_REGION)     llResetScript();&lt;br /&gt;
    }//changed&lt;br /&gt;
    &lt;br /&gt;
    dataserver(key query_id, string data)&lt;br /&gt;
    {&lt;br /&gt;
        if (query_id == gRateingQuery)&lt;br /&gt;
        {&lt;br /&gt;
            if (data == &amp;quot;MATURE&amp;quot; || data == &amp;quot;ADULT&amp;quot;)        show();&lt;br /&gt;
            else if (data == &amp;quot;UNKNOWN&amp;quot; || data == &amp;quot;PG&amp;quot;)     hide();&lt;br /&gt;
        }//gRateingQuery&lt;br /&gt;
    }//dataserver&lt;br /&gt;
    &lt;br /&gt;
}//default&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|helpers&lt;br /&gt;
|also_functions=&lt;br /&gt;
{{LSL DefineRow||[[llGetEnv]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llGetParcelDetails]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llGetParcelFlags]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llGetParcelMaxPrims]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llGetParcelPrimCount]]|}}&lt;br /&gt;
|also_tests=&lt;br /&gt;
{{LSL DefineRow||[[llRequestSimulatorData Test]]}}&lt;br /&gt;
|also_events&lt;br /&gt;
|also_articles&lt;br /&gt;
|notes=Global Position in meters&lt;br /&gt;
|issues&lt;br /&gt;
|cat1=Dataserver&lt;br /&gt;
|cat2=Region&lt;br /&gt;
|cat3&lt;br /&gt;
|cat4&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Reconx86 Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LlRequestSimulatorData&amp;diff=1200445</id>
		<title>LlRequestSimulatorData</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LlRequestSimulatorData&amp;diff=1200445"/>
		<updated>2016-06-12T11:02:07Z</updated>

		<summary type="html">&lt;p&gt;Reconx86 Resident: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL_Function&lt;br /&gt;
|inject-2={{Issues/SVC-2596}}{{Issues/SVC-4921}}{{Issues/BUG-5031}}&lt;br /&gt;
|func_id=293|func_sleep=1.0|func_energy=10.0&lt;br /&gt;
|func=llRequestSimulatorData&lt;br /&gt;
|return_type=key&lt;br /&gt;
|return_subtype=handle&lt;br /&gt;
|p1_type=string|p1_name=region|p1_desc=Case sensitive region name.&lt;br /&gt;
|p2_type=integer|p2_name=data|p2_desc=DATA_* flag&lt;br /&gt;
|func_footnote&lt;br /&gt;
|func_desc=Requests {{LSLP|data}} about {{LSLP|region}}. When {{LSLP|data}} is available the {{LSLG|dataserver}} event will be raised.&lt;br /&gt;
|return_text=for a {{LSLG|dataserver}} event response.&lt;br /&gt;
|spec&lt;br /&gt;
|caveats=&lt;br /&gt;
*There is no DATA_SIM_TYPE or DATA_SIM_MAXPRIMS flags. [[#SVC-4921|SVC-4921]]&lt;br /&gt;
|constants={{{!}} {{Prettytable|style=margin-top:0;}}&lt;br /&gt;
{{!}}- {{Hl2}}&lt;br /&gt;
! colspan=&amp;quot;2&amp;quot; {{!}} {{LSL Param|data}} Constant&lt;br /&gt;
! Type&lt;br /&gt;
! colspan=&amp;quot;4&amp;quot; {{!}} Description&lt;br /&gt;
{{!}}-&lt;br /&gt;
{{LSL_Constants/llRequestedSimulatorData}}&lt;br /&gt;
{{!}}}&lt;br /&gt;
|examples=Hide objects in PG or unknown regions&lt;br /&gt;
&amp;lt;source lang=&amp;quot;lsl2&amp;quot;&amp;gt;&lt;br /&gt;
key         gRateingQuery       =   NULL_KEY        ;&lt;br /&gt;
&lt;br /&gt;
show()&lt;br /&gt;
{&lt;br /&gt;
    llSetLinkAlpha( LINK_SET, 1.0, ALL_SIDES );&lt;br /&gt;
}//show&lt;br /&gt;
&lt;br /&gt;
hide()&lt;br /&gt;
{&lt;br /&gt;
     llSetLinkAlpha( LINK_SET, 0.0, ALL_SIDES );&lt;br /&gt;
}//hide&lt;br /&gt;
&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    on_rez(integer Setting)&lt;br /&gt;
    {&lt;br /&gt;
        llResetScript();&lt;br /&gt;
    }//on_rez&lt;br /&gt;
    &lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        gRateingQuery = llRequestSimulatorData( llGetRegionName(), DATA_SIM_RATING );&lt;br /&gt;
    }//state_entry&lt;br /&gt;
   &lt;br /&gt;
    changed(integer ItChanged)&lt;br /&gt;
    {&lt;br /&gt;
        if (ItChanged &amp;amp; CHANGED_OWNER)      llResetScript();&lt;br /&gt;
        if (ItChanged &amp;amp; CHANGED_REGION)     llResetScript();&lt;br /&gt;
    }//changed&lt;br /&gt;
    &lt;br /&gt;
    dataserver(key query_id, string data)&lt;br /&gt;
    {&lt;br /&gt;
        if (query_id == gRateingQuery)&lt;br /&gt;
        {&lt;br /&gt;
            if (data == &amp;quot;MATURE&amp;quot; || data == &amp;quot;ADULT&amp;quot;)        show();&lt;br /&gt;
            else if (data == &amp;quot;UNKNOWN&amp;quot; || data == &amp;quot;PG&amp;quot;)     hide();&lt;br /&gt;
        }//gRateingQuery&lt;br /&gt;
    }//dataserver&lt;br /&gt;
    &lt;br /&gt;
}//default&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|helpers&lt;br /&gt;
|also_functions=&lt;br /&gt;
{{LSL DefineRow||[[llGetParcelDetails]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llGetParcelFlags]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llGetParcelMaxPrims]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llGetParcelPrimCount]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llGetEnv]]|}}&lt;br /&gt;
|also_tests=&lt;br /&gt;
{{LSL DefineRow||[[llRequestSimulatorData Test]]}}&lt;br /&gt;
|also_events&lt;br /&gt;
|also_articles&lt;br /&gt;
|notes=Global Position in meters&lt;br /&gt;
|issues&lt;br /&gt;
|cat1=Dataserver&lt;br /&gt;
|cat2=Region&lt;br /&gt;
|cat3&lt;br /&gt;
|cat4&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Reconx86 Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=Event_Order&amp;diff=1200039</id>
		<title>Event Order</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=Event_Order&amp;diff=1200039"/>
		<updated>2016-05-01T23:42:42Z</updated>

		<summary type="html">&lt;p&gt;Reconx86 Resident: /* Wear or Attach from inventory (after changing owner) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Header|ml=*}}{{LSLC|Events}}{{RightToc}}&lt;br /&gt;
The follow lists show which events are called for different actions and the order in which they are called.&lt;br /&gt;
&lt;br /&gt;
=Wear or Attach from inventory / Login with item attached=&lt;br /&gt;
*[[On rez]] Event&lt;br /&gt;
*[[Attach]] Event  ([[Key]] id != {{LSL_Constant/NULL_KEY}})&lt;br /&gt;
&lt;br /&gt;
=Wear or Attach from inventory after changing owners=&lt;br /&gt;
*[[On rez]] Event&lt;br /&gt;
*[[Attach]] Event  ([[Key]] id != {{LSL_Constant/NULL_KEY}})&lt;br /&gt;
*[[Changed]] Event  ([[integer]] change &amp;amp; CHANGED_OWNER == [[TRUE]])&lt;br /&gt;
&lt;br /&gt;
=Attach from ground=&lt;br /&gt;
*[[Attach]] Event  ([[Key]] id != {{LSL_Constant/NULL_KEY}})&lt;br /&gt;
    &lt;br /&gt;
=Detach to inventory / Drop from avatar to ground=&lt;br /&gt;
*[[Attach]] Event  ([[Key]] id = {{LSL_Constant/NULL_KEY}})&lt;br /&gt;
    &lt;br /&gt;
=Rez to ground=&lt;br /&gt;
*[[On rez]] Event&lt;br /&gt;
    &lt;br /&gt;
=Reset while worn / Reset while on ground=&lt;br /&gt;
*[[State entry]] Event&lt;br /&gt;
&lt;br /&gt;
=Change in state=&lt;br /&gt;
*[[State exit]] Event  (In current state)&lt;br /&gt;
*[[State entry]] Event  (In target state)&lt;/div&gt;</summary>
		<author><name>Reconx86 Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=Event_Order&amp;diff=1200038</id>
		<title>Event Order</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=Event_Order&amp;diff=1200038"/>
		<updated>2016-05-01T23:41:52Z</updated>

		<summary type="html">&lt;p&gt;Reconx86 Resident: /* owner changed / attach from inventory */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Header|ml=*}}{{LSLC|Events}}{{RightToc}}&lt;br /&gt;
The follow lists show which events are called for different actions and the order in which they are called.&lt;br /&gt;
&lt;br /&gt;
=Wear or Attach from inventory / Login with item attached=&lt;br /&gt;
*[[On rez]] Event&lt;br /&gt;
*[[Attach]] Event  ([[Key]] id != {{LSL_Constant/NULL_KEY}})&lt;br /&gt;
&lt;br /&gt;
=Wear or Attach from inventory (after changing owner)=&lt;br /&gt;
*[[On rez]] Event&lt;br /&gt;
*[[Attach]] Event  ([[Key]] id != {{LSL_Constant/NULL_KEY}})&lt;br /&gt;
*[[Changed]] Event  ([[integer]] change &amp;amp; CHANGED_OWNER == [[TRUE]])&lt;br /&gt;
&lt;br /&gt;
=Attach from ground=&lt;br /&gt;
*[[Attach]] Event  ([[Key]] id != {{LSL_Constant/NULL_KEY}})&lt;br /&gt;
    &lt;br /&gt;
=Detach to inventory / Drop from avatar to ground=&lt;br /&gt;
*[[Attach]] Event  ([[Key]] id = {{LSL_Constant/NULL_KEY}})&lt;br /&gt;
    &lt;br /&gt;
=Rez to ground=&lt;br /&gt;
*[[On rez]] Event&lt;br /&gt;
    &lt;br /&gt;
=Reset while worn / Reset while on ground=&lt;br /&gt;
*[[State entry]] Event&lt;br /&gt;
&lt;br /&gt;
=Change in state=&lt;br /&gt;
*[[State exit]] Event  (In current state)&lt;br /&gt;
*[[State entry]] Event  (In target state)&lt;/div&gt;</summary>
		<author><name>Reconx86 Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=Event_Order&amp;diff=1200037</id>
		<title>Event Order</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=Event_Order&amp;diff=1200037"/>
		<updated>2016-05-01T23:40:30Z</updated>

		<summary type="html">&lt;p&gt;Reconx86 Resident: /* owner changed / attach from inventory */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Header|ml=*}}{{LSLC|Events}}{{RightToc}}&lt;br /&gt;
The follow lists show which events are called for different actions and the order in which they are called.&lt;br /&gt;
&lt;br /&gt;
=Wear or Attach from inventory / Login with item attached=&lt;br /&gt;
*[[On rez]] Event&lt;br /&gt;
*[[Attach]] Event  ([[Key]] id != {{LSL_Constant/NULL_KEY}})&lt;br /&gt;
&lt;br /&gt;
=owner changed / attach from inventory=&lt;br /&gt;
*[[On rez]] Event&lt;br /&gt;
*[[Attach]] Event  ([[Key]] id != {{LSL_Constant/NULL_KEY}})&lt;br /&gt;
*[[Changed]] Event  ([[integer]] change &amp;amp; CHANGED_OWNER == [[TRUE]])&lt;br /&gt;
&lt;br /&gt;
=Attach from ground=&lt;br /&gt;
*[[Attach]] Event  ([[Key]] id != {{LSL_Constant/NULL_KEY}})&lt;br /&gt;
    &lt;br /&gt;
=Detach to inventory / Drop from avatar to ground=&lt;br /&gt;
*[[Attach]] Event  ([[Key]] id = {{LSL_Constant/NULL_KEY}})&lt;br /&gt;
    &lt;br /&gt;
=Rez to ground=&lt;br /&gt;
*[[On rez]] Event&lt;br /&gt;
    &lt;br /&gt;
=Reset while worn / Reset while on ground=&lt;br /&gt;
*[[State entry]] Event&lt;br /&gt;
&lt;br /&gt;
=Change in state=&lt;br /&gt;
*[[State exit]] Event  (In current state)&lt;br /&gt;
*[[State entry]] Event  (In target state)&lt;/div&gt;</summary>
		<author><name>Reconx86 Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=Event_Order&amp;diff=1200036</id>
		<title>Event Order</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=Event_Order&amp;diff=1200036"/>
		<updated>2016-05-01T23:38:59Z</updated>

		<summary type="html">&lt;p&gt;Reconx86 Resident: /* owner changed / attach from inventory */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Header|ml=*}}{{LSLC|Events}}{{RightToc}}&lt;br /&gt;
The follow lists show which events are called for different actions and the order in which they are called.&lt;br /&gt;
&lt;br /&gt;
=Wear or Attach from inventory / Login with item attached=&lt;br /&gt;
*[[On rez]] Event&lt;br /&gt;
*[[Attach]] Event  ([[Key]] id != {{LSL_Constant/NULL_KEY}})&lt;br /&gt;
&lt;br /&gt;
=owner changed / attach from inventory=&lt;br /&gt;
*[[On rez]] Event&lt;br /&gt;
*[[Attach]] Event  ([[Key]] id != {{LSL_Constant/NULL_KEY}})&lt;br /&gt;
*[[Changed]] Event  ([[integer]] change &amp;amp; CHANGED_OWNER == TRUE)&lt;br /&gt;
&lt;br /&gt;
=Attach from ground=&lt;br /&gt;
*[[Attach]] Event  ([[Key]] id != {{LSL_Constant/NULL_KEY}})&lt;br /&gt;
    &lt;br /&gt;
=Detach to inventory / Drop from avatar to ground=&lt;br /&gt;
*[[Attach]] Event  ([[Key]] id = {{LSL_Constant/NULL_KEY}})&lt;br /&gt;
    &lt;br /&gt;
=Rez to ground=&lt;br /&gt;
*[[On rez]] Event&lt;br /&gt;
    &lt;br /&gt;
=Reset while worn / Reset while on ground=&lt;br /&gt;
*[[State entry]] Event&lt;br /&gt;
&lt;br /&gt;
=Change in state=&lt;br /&gt;
*[[State exit]] Event  (In current state)&lt;br /&gt;
*[[State entry]] Event  (In target state)&lt;/div&gt;</summary>
		<author><name>Reconx86 Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=Event_Order&amp;diff=1200035</id>
		<title>Event Order</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=Event_Order&amp;diff=1200035"/>
		<updated>2016-05-01T23:36:27Z</updated>

		<summary type="html">&lt;p&gt;Reconx86 Resident: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Header|ml=*}}{{LSLC|Events}}{{RightToc}}&lt;br /&gt;
The follow lists show which events are called for different actions and the order in which they are called.&lt;br /&gt;
&lt;br /&gt;
=Wear or Attach from inventory / Login with item attached=&lt;br /&gt;
*[[On rez]] Event&lt;br /&gt;
*[[Attach]] Event  ([[Key]] id != {{LSL_Constant/NULL_KEY}})&lt;br /&gt;
&lt;br /&gt;
=owner changed / attach from inventory=&lt;br /&gt;
*[[On rez]] Event&lt;br /&gt;
*[[Attach]] Event  ([[Key]] id != {{LSL_Constant/NULL_KEY}})&lt;br /&gt;
*[[Changed]] Event  ([[integer]] change &amp;amp; CHANGED_OWNER == {{LSL_Constant/TRUE}})&lt;br /&gt;
&lt;br /&gt;
=Attach from ground=&lt;br /&gt;
*[[Attach]] Event  ([[Key]] id != {{LSL_Constant/NULL_KEY}})&lt;br /&gt;
    &lt;br /&gt;
=Detach to inventory / Drop from avatar to ground=&lt;br /&gt;
*[[Attach]] Event  ([[Key]] id = {{LSL_Constant/NULL_KEY}})&lt;br /&gt;
    &lt;br /&gt;
=Rez to ground=&lt;br /&gt;
*[[On rez]] Event&lt;br /&gt;
    &lt;br /&gt;
=Reset while worn / Reset while on ground=&lt;br /&gt;
*[[State entry]] Event&lt;br /&gt;
&lt;br /&gt;
=Change in state=&lt;br /&gt;
*[[State exit]] Event  (In current state)&lt;br /&gt;
*[[State entry]] Event  (In target state)&lt;/div&gt;</summary>
		<author><name>Reconx86 Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LlJsonGetValue&amp;diff=1196437</id>
		<title>LlJsonGetValue</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LlJsonGetValue&amp;diff=1196437"/>
		<updated>2015-05-09T12:33:18Z</updated>

		<summary type="html">&lt;p&gt;Reconx86 Resident: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Function&lt;br /&gt;
|inject-2={{Issues/BUG-3692}}&lt;br /&gt;
|func_id=|func_sleep=0.0|func_energy=10.0&lt;br /&gt;
|func=llJsonGetValue|return_type=string|p1_type=string|p1_name=json|p2_type=list|p2_name=specifiers&lt;br /&gt;
|func_desc=Gets the value indicated by specifiers from the [http://json.org json] string.&lt;br /&gt;
|return_text=made by parsing &#039;&#039;&#039;json&#039;&#039;&#039;, a string representing json and traversing as specified by &#039;&#039;&#039;specifiers&#039;&#039;&#039;.&lt;br /&gt;
|func_footnote=When the input is invalid or no result can be found this function returns [[JSON_INVALID]]. If the result is &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt; the function returns [[JSON_NULL]].&lt;br /&gt;
|spec=See [[Json_usage_in_LSL]]&lt;br /&gt;
|constants&lt;br /&gt;
|examples=&lt;br /&gt;
&amp;lt;source lang=&amp;quot;lsl2&amp;quot;&amp;gt;&lt;br /&gt;
default {&lt;br /&gt;
    state_entry() {&lt;br /&gt;
     &lt;br /&gt;
     //below is an example of a JSON=string with a key called &amp;quot;key&amp;quot; and a value &amp;quot;val&amp;quot; &lt;br /&gt;
     string json1 = &amp;quot;{\&amp;quot;key\&amp;quot;:\&amp;quot;val\&amp;quot;}&amp;quot;;&lt;br /&gt;
     llSay(0, llJsonGetValue( json1, [&amp;quot;key&amp;quot;]));//returns &amp;quot;val&amp;quot; in localchat&lt;br /&gt;
&lt;br /&gt;
     string json2 = &amp;quot;{\&amp;quot;mansBestFriend\&amp;quot;:\&amp;quot;dog\&amp;quot;}&amp;quot;;&lt;br /&gt;
     llSay(0, llJsonGetValue( json2, [&amp;quot;mansBestFriend&amp;quot;]));//returns &amp;quot;dog&amp;quot; in localchat&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;lsl2&amp;quot;&amp;gt;&lt;br /&gt;
JGetValTest(){&lt;br /&gt;
    string j=&amp;quot;[[1,2],[4,5,6]]&amp;quot;;            //JSON may be written directly as a string like this in sl.&lt;br /&gt;
    string k;                              //this will change with each command below;&lt;br /&gt;
    k=llJsonGetValue(j,[]);                //returns the whole array of a JSON. It might just be one entry or a whole nested array or whole nested object.&lt;br /&gt;
    //if &amp;quot;j&amp;quot; is a single JSON_STRING, this may return what the string represents as a JSON within a string; a JSON_NUMBER , JSON_TRUE, TRUE ...&lt;br /&gt;
&lt;br /&gt;
    k=llJsonGetValue(&amp;quot;\&amp;quot;3.14\&amp;quot;&amp;quot;,[]);       //==k=&amp;quot;3,14&amp;quot; (float that was stored in a JSON_STRING within a JSON. and not as JSON_NUMBER for no good reason)&lt;br /&gt;
    k=llJsonGetValue(&amp;quot;\&amp;quot;TRUE\&amp;quot;&amp;quot;     ,[]);  //==k=&amp;quot;TRUE&amp;quot; (the value was stored as a JSON_STRING and is thus returned verbatim)&lt;br /&gt;
    k=llJsonGetValue(j,[0]);               //returns only the first entry (at offset 0). An entry can be any JSON type,&lt;br /&gt;
                                           //each entry being separated by a comma from other entries.&lt;br /&gt;
                                           //array and object entries may contain multiple comma separated entries within them.&lt;br /&gt;
    k=llJsonGetValue(j,[1]);//returns only the second entry... (all the above still applies) k=&amp;quot;[4,5,6]&amp;quot;;&lt;br /&gt;
    k=llJsonGetValue(llJsonGetValue(j,[1]),[2]);&lt;br /&gt;
                                           //instead of getting an entry from &amp;quot;j&amp;quot; we get a sub-entry from llJsonGetValue(j,[1]), &lt;br /&gt;
                                           //assuming the sub-entry is a JSON_ARRAY. It returns the 3rd sub-entry of the second entry, &lt;br /&gt;
                                           //that is an array with 3 entries. it would make k=&amp;quot;6&amp;quot;. &lt;br /&gt;
                                           //it will return JSON_INVALID if there is no 3rd entry in the 2nd sub-array,&lt;br /&gt;
                                           //or no 2nd sub-array.&lt;br /&gt;
    k=llJsonGetValue(j,[1,2]);             //Shorter way to do the same as in the previous example.&lt;br /&gt;
    k=llJsonGetValue(&amp;quot;true&amp;quot;,[]);           //Sets k to JSON_TRUE&lt;br /&gt;
    k=llJsonGetValue(&amp;quot;True&amp;quot;,[]);           //Sets k to JSON_INVALID because the JSON constant for &#039;true&#039; is all lower case&lt;br /&gt;
    k=llJsonGetValue(&amp;quot;TRUE&amp;quot;,[]);           //Sets k to JSON_INVALID because the JSON constant for &#039;true&#039; is all lower case&lt;br /&gt;
    k=llJsonGetValue(JSON_TRUE,[]);        //Sets k to JSON_INVALID. The JSON_xxxx constants are not supposed to be part of&lt;br /&gt;
                                           // a JSON string, just values to test against.&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
See also [[llJsonValueType]] for examples where the value type is checked before getting the value as that type.&lt;br /&gt;
&lt;br /&gt;
|caveats=&lt;br /&gt;
&lt;br /&gt;
llJsonGetValue() is significantly slower than reading a value from a list with llList2String(). &lt;br /&gt;
But with llList2String , you will need to parse your string and convert it to list .&lt;br /&gt;
llJsonGetValue() is significantly faster  when you will need to parse your string :&lt;br /&gt;
for instance by  llList2String( llParseString2List( yourstring ,  [ delimiters], [ spacers] ) , N );&lt;br /&gt;
When you need to iterate intensively , think about llJson2List.&lt;br /&gt;
&lt;br /&gt;
|helpers&lt;br /&gt;
|also_functions={{LSL DefineRow||[[llList2Json]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llJson2List]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llJsonSetValue]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llJsonValueType]]|}}&lt;br /&gt;
|also_events&lt;br /&gt;
|also_tests&lt;br /&gt;
|also_articles={{LSL DefineRow||[[Typecast]]|}}&lt;br /&gt;
|notes=&lt;br /&gt;
|permission&lt;br /&gt;
|negative_index&lt;br /&gt;
|sort=JsonGetValue&lt;br /&gt;
|cat1=List&lt;br /&gt;
|cat2=String&lt;br /&gt;
|cat3=Data Conversion&lt;br /&gt;
|cat4=JSON&lt;br /&gt;
|history = Date of Release  [[ Release_Notes/Second_Life_Server/13#13.05.20.276191 | 20/05/2013 ]]&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Reconx86 Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LlJsonGetValue&amp;diff=1196436</id>
		<title>LlJsonGetValue</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LlJsonGetValue&amp;diff=1196436"/>
		<updated>2015-05-09T12:32:44Z</updated>

		<summary type="html">&lt;p&gt;Reconx86 Resident: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Function&lt;br /&gt;
|inject-2={{Issues/BUG-3692}}&lt;br /&gt;
|func_id=|func_sleep=0.0|func_energy=10.0&lt;br /&gt;
|func=llJsonGetValue|return_type=string|p1_type=string|p1_name=json|p2_type=list|p2_name=specifiers&lt;br /&gt;
|func_desc=Gets the value indicated by specifiers from the [http://json.org json] string.&lt;br /&gt;
|return_text=made by parsing &#039;&#039;&#039;json&#039;&#039;&#039;, a string representing json and traversing as specified by &#039;&#039;&#039;specifiers&#039;&#039;&#039;.&lt;br /&gt;
|func_footnote=When the input is invalid or no result can be found this function returns [[JSON_INVALID]]. If the result is &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt; the function returns [[JSON_NULL]].&lt;br /&gt;
|spec=See [[Json_usage_in_LSL]]&lt;br /&gt;
|constants&lt;br /&gt;
|examples=&lt;br /&gt;
&amp;lt;source lang=&amp;quot;lsl2&amp;quot;&amp;gt;&lt;br /&gt;
default {&lt;br /&gt;
    state_entry() {&lt;br /&gt;
     &lt;br /&gt;
     //below is an example of a JSON=string with a key called &amp;quot;key&amp;quot; and a value &amp;quot;val&amp;quot; &lt;br /&gt;
     string json1 = &amp;quot;{\&amp;quot;key\&amp;quot;:\&amp;quot;val\&amp;quot;}&amp;quot;;&lt;br /&gt;
     llSay(0,llJsonGetValue( json1, [&amp;quot;key&amp;quot;]));//returns &amp;quot;val&amp;quot; in localchat&lt;br /&gt;
&lt;br /&gt;
     string json2 = &amp;quot;{\&amp;quot;mansBestFriend\&amp;quot;:\&amp;quot;dog\&amp;quot;}&amp;quot;;&lt;br /&gt;
     llSay(0,llJsonGetValue( json2, [&amp;quot;mansBestFriend&amp;quot;]));//returns &amp;quot;dog&amp;quot; in localchat&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;lsl2&amp;quot;&amp;gt;&lt;br /&gt;
JGetValTest(){&lt;br /&gt;
    string j=&amp;quot;[[1,2],[4,5,6]]&amp;quot;;            //JSON may be written directly as a string like this in sl.&lt;br /&gt;
    string k;                              //this will change with each command below;&lt;br /&gt;
    k=llJsonGetValue(j,[]);                //returns the whole array of a JSON. It might just be one entry or a whole nested array or whole nested object.&lt;br /&gt;
    //if &amp;quot;j&amp;quot; is a single JSON_STRING, this may return what the string represents as a JSON within a string; a JSON_NUMBER , JSON_TRUE, TRUE ...&lt;br /&gt;
&lt;br /&gt;
    k=llJsonGetValue(&amp;quot;\&amp;quot;3.14\&amp;quot;&amp;quot;,[]);       //==k=&amp;quot;3,14&amp;quot; (float that was stored in a JSON_STRING within a JSON. and not as JSON_NUMBER for no good reason)&lt;br /&gt;
    k=llJsonGetValue(&amp;quot;\&amp;quot;TRUE\&amp;quot;&amp;quot;     ,[]);  //==k=&amp;quot;TRUE&amp;quot; (the value was stored as a JSON_STRING and is thus returned verbatim)&lt;br /&gt;
    k=llJsonGetValue(j,[0]);               //returns only the first entry (at offset 0). An entry can be any JSON type,&lt;br /&gt;
                                           //each entry being separated by a comma from other entries.&lt;br /&gt;
                                           //array and object entries may contain multiple comma separated entries within them.&lt;br /&gt;
    k=llJsonGetValue(j,[1]);//returns only the second entry... (all the above still applies) k=&amp;quot;[4,5,6]&amp;quot;;&lt;br /&gt;
    k=llJsonGetValue(llJsonGetValue(j,[1]),[2]);&lt;br /&gt;
                                           //instead of getting an entry from &amp;quot;j&amp;quot; we get a sub-entry from llJsonGetValue(j,[1]), &lt;br /&gt;
                                           //assuming the sub-entry is a JSON_ARRAY. It returns the 3rd sub-entry of the second entry, &lt;br /&gt;
                                           //that is an array with 3 entries. it would make k=&amp;quot;6&amp;quot;. &lt;br /&gt;
                                           //it will return JSON_INVALID if there is no 3rd entry in the 2nd sub-array,&lt;br /&gt;
                                           //or no 2nd sub-array.&lt;br /&gt;
    k=llJsonGetValue(j,[1,2]);             //Shorter way to do the same as in the previous example.&lt;br /&gt;
    k=llJsonGetValue(&amp;quot;true&amp;quot;,[]);           //Sets k to JSON_TRUE&lt;br /&gt;
    k=llJsonGetValue(&amp;quot;True&amp;quot;,[]);           //Sets k to JSON_INVALID because the JSON constant for &#039;true&#039; is all lower case&lt;br /&gt;
    k=llJsonGetValue(&amp;quot;TRUE&amp;quot;,[]);           //Sets k to JSON_INVALID because the JSON constant for &#039;true&#039; is all lower case&lt;br /&gt;
    k=llJsonGetValue(JSON_TRUE,[]);        //Sets k to JSON_INVALID. The JSON_xxxx constants are not supposed to be part of&lt;br /&gt;
                                           // a JSON string, just values to test against.&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
See also [[llJsonValueType]] for examples where the value type is checked before getting the value as that type.&lt;br /&gt;
&lt;br /&gt;
|caveats=&lt;br /&gt;
&lt;br /&gt;
llJsonGetValue() is significantly slower than reading a value from a list with llList2String(). &lt;br /&gt;
But with llList2String , you will need to parse your string and convert it to list .&lt;br /&gt;
llJsonGetValue() is significantly faster  when you will need to parse your string :&lt;br /&gt;
for instance by  llList2String( llParseString2List( yourstring ,  [ delimiters], [ spacers] ) , N );&lt;br /&gt;
When you need to iterate intensively , think about llJson2List.&lt;br /&gt;
&lt;br /&gt;
|helpers&lt;br /&gt;
|also_functions={{LSL DefineRow||[[llList2Json]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llJson2List]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llJsonSetValue]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llJsonValueType]]|}}&lt;br /&gt;
|also_events&lt;br /&gt;
|also_tests&lt;br /&gt;
|also_articles={{LSL DefineRow||[[Typecast]]|}}&lt;br /&gt;
|notes=&lt;br /&gt;
|permission&lt;br /&gt;
|negative_index&lt;br /&gt;
|sort=JsonGetValue&lt;br /&gt;
|cat1=List&lt;br /&gt;
|cat2=String&lt;br /&gt;
|cat3=Data Conversion&lt;br /&gt;
|cat4=JSON&lt;br /&gt;
|history = Date of Release  [[ Release_Notes/Second_Life_Server/13#13.05.20.276191 | 20/05/2013 ]]&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Reconx86 Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LlJsonSetValue&amp;diff=1196308</id>
		<title>LlJsonSetValue</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LlJsonSetValue&amp;diff=1196308"/>
		<updated>2015-04-29T03:00:07Z</updated>

		<summary type="html">&lt;p&gt;Reconx86 Resident: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Function&lt;br /&gt;
|inject-2={{Issues/BUG-3692}}&lt;br /&gt;
|inject-3={{LSL_Function/negative index|false|specifiers|nc=*}}&lt;br /&gt;
|func_id=|func_sleep=0.0|func_energy=10.0&lt;br /&gt;
|func=llJsonSetValue&lt;br /&gt;
|return_type=string&lt;br /&gt;
|p1_type=string|p1_name=json|p1_desc=source JSON data&lt;br /&gt;
|p2_type=list|p2_name=specifiers|p2_desc=location of the of the value to be added, updated or deleted.&lt;br /&gt;
|p3_type=string|p3_name=value|p3_desc=new value or [[JSON_DELETE]] flag.|p3_hover=new value or JSON_DELETE flag.&lt;br /&gt;
|func_footnote&lt;br /&gt;
|func_desc=Returns, if successful, a new [http://json.org JSON] text &#039;&#039;string&#039;&#039; which is {{LSLPT|json}} with the value indicated by the {{LSLPT|specifiers}} list set to {{LSLPT|value}}.&lt;br /&gt;
&lt;br /&gt;
If unsuccessful (usually because of specifying an out of range array index) it returns [[JSON_INVALID]].&lt;br /&gt;
&lt;br /&gt;
An &amp;quot;out of range array index&amp;quot; is defined to be any Integer {{LSLPT|specifiers}} greater than the length of an existing array at that level within the Json text or greater than 0 (zero) at a level an array doesn&#039;t exist.&lt;br /&gt;
&lt;br /&gt;
A special {{LSLPT|specifiers}}, [[JSON_APPEND]], is accepted which appends the {{LSLPT|value}} to the end of the array at the {{LSLPT|specifiers}} level. Care should be taken- if that level is not an array, the existing Value there will be overwritten and replaced with an array containing {{LSLPT|value}} at it&#039;s first (0) index.&lt;br /&gt;
&lt;br /&gt;
Contrary to [[list]]s and [[string]]s, negative indexing of Json arrays is &#039;&#039;&#039;not&#039;&#039;&#039; supported.&lt;br /&gt;
&lt;br /&gt;
If an existing &amp;quot;Key&amp;quot; is {{LSLPT|specifiers}} at that level, its Value will be overwritten by {{LSLPT|value}} unless {{LSLPT|value}} is the magic value [[JSON_DELETE]]. If a value does not exist at {{LSLPT|specifiers}}, a new Key:Value pair will be formed within the Json object. &lt;br /&gt;
&lt;br /&gt;
To delete an existing value at {{LSLPT|specifiers}}, use [[JSON_DELETE]] as the {{LSLPT|value}}. Note it will not prune empty objects or arrays at higher levels.&lt;br /&gt;
&lt;br /&gt;
If {{LSLPT|value}} is [[JSON_TRUE]], [[JSON_FALSE]] or [[JSON_NULL]], the Value set will be the bare words &#039;true&#039;, &#039;false&#039; or &#039;null&#039;, respectively, at the {{LSLPT|specifiers}} location within {{LSLPT|json}}.&lt;br /&gt;
|return_text=&lt;br /&gt;
|spec=See [[Json_usage_in_LSL]]&lt;br /&gt;
|constants&lt;br /&gt;
|examples=&lt;br /&gt;
&amp;lt;source lang=&amp;quot;lsl2&amp;quot;&amp;gt;&lt;br /&gt;
string TEST_STRING_JSON;&lt;br /&gt;
&lt;br /&gt;
init()&lt;br /&gt;
{&lt;br /&gt;
    TEST_STRING_JSON = &amp;quot;[9,\&amp;quot;&amp;lt;1,1,1&amp;gt;\&amp;quot;,false,{\&amp;quot;A\&amp;quot;:8,\&amp;quot;Z\&amp;quot;:9}]&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;Original TEST_STRING_JSON: &amp;quot; + TEST_STRING_JSON);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
run_json_test(string input)&lt;br /&gt;
{&lt;br /&gt;
    string output;&lt;br /&gt;
&lt;br /&gt;
//  changing values within the json string&lt;br /&gt;
&lt;br /&gt;
//  change the first value in the array to 10&lt;br /&gt;
    output = llJsonSetValue(input, [0], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [10,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;( 1): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  change the third value in the array to &#039;true&#039;&lt;br /&gt;
    output = llJsonSetValue(input, [2], JSON_TRUE);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,true,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;( 2): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  change the value of &amp;quot;A&amp;quot; within the Json object to 3&lt;br /&gt;
    output = llJsonSetValue(input, [3, &amp;quot;A&amp;quot;], &amp;quot;3&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:3,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;( 3): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  adding a value or new key-value-pair within the input&lt;br /&gt;
&lt;br /&gt;
//  add the value &amp;quot;Hello&amp;quot; to the end of the array&lt;br /&gt;
//      NOTE: One cannot insert, only add to the end&lt;br /&gt;
    output = llJsonSetValue(input, [JSON_APPEND], &amp;quot;Hello&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9},&amp;quot;Hello&amp;quot;]&lt;br /&gt;
    say(&amp;quot;( 4): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  add the key-value-pair &amp;quot;B&amp;quot;:10 to the object&lt;br /&gt;
    output = llJsonSetValue(input, [3, &amp;quot;B&amp;quot;], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;B&amp;quot;:10,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;( 5): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//  Things to look out for when modifying Json text&lt;br /&gt;
//      ~!~ Be careful when using this function ~!~&lt;br /&gt;
&lt;br /&gt;
//  out of bounds array assignment:&lt;br /&gt;
//      defined as attempting to add a value to a position ...&lt;br /&gt;
//      ...greater than the length of the array (which may be 0)&lt;br /&gt;
//      JSON_APPEND is ALWAYS the preferred way to add to an array&lt;br /&gt;
    output = llJsonSetValue(input, [5], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  %EF%B7%90 (URL escaped JSON_INVALID)&lt;br /&gt;
    say(&amp;quot;( 6): &amp;quot; + llEscapeURL(output));&lt;br /&gt;
&lt;br /&gt;
//  BUT, this works, since it is in bounds&lt;br /&gt;
//      (eqivalent to JSON_APPEND in this case)&lt;br /&gt;
    output = llJsonSetValue(input, [4], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9},10]&lt;br /&gt;
    say(&amp;quot;( 7): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  careless formation of new arrays&lt;br /&gt;
//      ( the 4 and all subsequent 0&#039;s are all in bounds.)&lt;br /&gt;
    output = llJsonSetValue(input, [4, 0, 0, 0], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9},[[[10]]]]&lt;br /&gt;
    say(&amp;quot;( 8): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  overwriting an object with an array:&lt;br /&gt;
//      ~!~ mistaken use of JSON_APPEND on an object ~!~&lt;br /&gt;
    output = llJsonSetValue(input, [3, JSON_APPEND], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,[10]]&lt;br /&gt;
    say(&amp;quot;( 9): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  careless formation of new objects&lt;br /&gt;
//      NOTE: &amp;quot;Key&amp;quot; assignemts will NEVER result in a return of JSON_INVALID!&lt;br /&gt;
    output = llJsonSetValue(input, [3, &amp;quot;W&amp;quot;, &amp;quot;X&amp;quot;], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;W&amp;quot;:{&amp;quot;X&amp;quot;:10},&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;(10): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
    output = llJsonSetValue(input, [3, &amp;quot;W&amp;quot;, &amp;quot;X&amp;quot;, &amp;quot;Y&amp;quot;], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;W&amp;quot;:{&amp;quot;X&amp;quot;:{&amp;quot;Y&amp;quot;:10}},&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;(11): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  overwriting an array with an object&lt;br /&gt;
    output = llJsonSetValue(input, [&amp;quot;X&amp;quot;], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  {&amp;quot;X&amp;quot;:10}&lt;br /&gt;
    say(&amp;quot;(12): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  special case considerations:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//  BUG-3692: (NOTE: Corrected in release 13.09.21.281328!)&lt;br /&gt;
//      a bug where, instead of JSON_INVALID being returned, if the out of&lt;br /&gt;
//      bounds index is at a lower level than the topmost (root) level, a&lt;br /&gt;
//      non-compliant JSON text would be formed&lt;br /&gt;
    output = llJsonSetValue(input, [1, 7], &amp;quot;Disappearing Text&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  Note the &amp;quot;empty&amp;quot; second position that resulted in the returned array&lt;br /&gt;
//  [9,,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
// (But now correctly shows JSON_INVALID)&lt;br /&gt;
    say(&amp;quot;(13): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  though there is no way to directly delete a key-value-pair &lt;br /&gt;
//  nor remove a value from an array,&lt;br /&gt;
//  the use of JSON_NULL may prove adequate&lt;br /&gt;
    output = llJsonSetValue(input, [3, &amp;quot;A&amp;quot;], JSON_NULL);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:null,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;(14): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  if a JSON text object has been formed with llList2Json()&lt;br /&gt;
//  that contains one or more duplicated &amp;quot;Keys&amp;quot;, (allowable&lt;br /&gt;
//  but NOT recommended!) ANY change&lt;br /&gt;
//  made to that object will correct the condition,&lt;br /&gt;
//  with all but the last such &amp;quot;Key&amp;quot; being removed&lt;br /&gt;
    output = llList2Json(JSON_OBJECT, [&amp;quot;A&amp;quot;, 1, &amp;quot;A&amp;quot;, 2, &amp;quot;A&amp;quot;, 3, &amp;quot;B&amp;quot;, 4, &amp;quot;B&amp;quot;, 4]);&lt;br /&gt;
&lt;br /&gt;
//  both Keys &amp;quot;A&amp;quot; and &amp;quot;B&amp;quot; are duplicated&lt;br /&gt;
//  {&amp;quot;A&amp;quot;:1,&amp;quot;A&amp;quot;:2,&amp;quot;A&amp;quot;:3,&amp;quot;B&amp;quot;:4,&amp;quot;B&amp;quot;:4}&lt;br /&gt;
    say(&amp;quot;(15): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  only the last value of the duplications is accessable though&lt;br /&gt;
&lt;br /&gt;
//  3&lt;br /&gt;
    say(&amp;quot;(16): &amp;quot; + llJsonGetValue(output, [&amp;quot;A&amp;quot;]));&lt;br /&gt;
&lt;br /&gt;
//  condition corrected by adding a key-value-pair...&lt;br /&gt;
&lt;br /&gt;
//  {&amp;quot;A&amp;quot;:3,&amp;quot;B&amp;quot;:4,&amp;quot;Z&amp;quot;:5}&lt;br /&gt;
    say(&amp;quot;(17): &amp;quot; + llJsonSetValue(output, [&amp;quot;Z&amp;quot;], &amp;quot;5&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
//  ... or by changing a value&lt;br /&gt;
&lt;br /&gt;
// {&amp;quot;A&amp;quot;:5,&amp;quot;B&amp;quot;:4}&lt;br /&gt;
    say(&amp;quot;(18): &amp;quot; + llJsonSetValue(output, [&amp;quot;A&amp;quot;], &amp;quot;5&amp;quot;));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
say(string message)&lt;br /&gt;
{&lt;br /&gt;
    llOwnerSay(message);&lt;br /&gt;
//  llRegionSayTo(llGetOwner(), PUBLIC_CHANNEL, message);&lt;br /&gt;
//  llWhisper(PUBLIC_CHANNEL, message);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    on_rez(integer start_param)&lt;br /&gt;
    {&lt;br /&gt;
        llResetScript();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        init();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    touch_end(integer num_detected)&lt;br /&gt;
    {&lt;br /&gt;
//      copy &#039;TEST_STRING_JSON&#039; from the following function call&lt;br /&gt;
//      to the string &#039;input&#039; in the function declaration&lt;br /&gt;
//      and run a test on &#039;input&#039; to not (!) modify &#039;TEST_STRING_JSON&#039;&lt;br /&gt;
//      but its copy instead&lt;br /&gt;
        run_json_test(TEST_STRING_JSON);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|caveats=&lt;br /&gt;
&lt;br /&gt;
JSON_DELETE does not work with json-objects (key-value pairs) only json-arrays, use JSON_NULL instead.&lt;br /&gt;
&lt;br /&gt;
llListReplaceList() is roughly 2,8x as fast in replacing a single value of a list than LlJsonSetValue() is to replace a single value in a json.&lt;br /&gt;
The length of the list/json are irrelevant here.&lt;br /&gt;
&lt;br /&gt;
|helpers&lt;br /&gt;
|also_functions={{LSL DefineRow||[[llList2Json]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llJson2List]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llJsonGetValue]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llJsonValueType]]|}}&lt;br /&gt;
|also_events&lt;br /&gt;
|also_tests&lt;br /&gt;
|also_articles={{LSL DefineRow||[[Typecast]]|}}&lt;br /&gt;
|notes=&lt;br /&gt;
|permission&lt;br /&gt;
|negative_index&lt;br /&gt;
|sort=JsonSetValue&lt;br /&gt;
|cat1=List&lt;br /&gt;
|cat2=String&lt;br /&gt;
|cat3=Data Conversion&lt;br /&gt;
|cat4=JSON&lt;br /&gt;
|history = Date of Release  [[ Release_Notes/Second_Life_Server/13#13.05.20.276191 | 20/05/2013 ]]&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Reconx86 Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LlJsonSetValue&amp;diff=1196307</id>
		<title>LlJsonSetValue</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LlJsonSetValue&amp;diff=1196307"/>
		<updated>2015-04-29T02:58:48Z</updated>

		<summary type="html">&lt;p&gt;Reconx86 Resident: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Function&lt;br /&gt;
|inject-2={{Issues/BUG-3692}}&lt;br /&gt;
|inject-3={{LSL_Function/negative index|false|specifiers|nc=*}}&lt;br /&gt;
|func_id=|func_sleep=0.0|func_energy=10.0&lt;br /&gt;
|func=llJsonSetValue&lt;br /&gt;
|return_type=string&lt;br /&gt;
|p1_type=string|p1_name=json|p1_desc=source JSON data&lt;br /&gt;
|p2_type=list|p2_name=specifiers|p2_desc=location of the of the value to be added, updated or deleted.&lt;br /&gt;
|p3_type=string|p3_name=value|p3_desc=new value or [[JSON_DELETE]] flag.|p3_hover=new value or JSON_DELETE flag.&lt;br /&gt;
|func_footnote&lt;br /&gt;
|func_desc=Returns, if successful, a new [http://json.org JSON] text &#039;&#039;string&#039;&#039; which is {{LSLPT|json}} with the value indicated by the {{LSLPT|specifiers}} list set to {{LSLPT|value}}.&lt;br /&gt;
&lt;br /&gt;
If unsuccessful (usually because of specifying an out of range array index) it returns [[JSON_INVALID]].&lt;br /&gt;
&lt;br /&gt;
An &amp;quot;out of range array index&amp;quot; is defined to be any Integer {{LSLPT|specifiers}} greater than the length of an existing array at that level within the Json text or greater than 0 (zero) at a level an array doesn&#039;t exist.&lt;br /&gt;
&lt;br /&gt;
A special {{LSLPT|specifiers}}, [[JSON_APPEND]], is accepted which appends the {{LSLPT|value}} to the end of the array at the {{LSLPT|specifiers}} level. Care should be taken- if that level is not an array, the existing Value there will be overwritten and replaced with an array containing {{LSLPT|value}} at it&#039;s first (0) index.&lt;br /&gt;
&lt;br /&gt;
Contrary to [[list]]s and [[string]]s, negative indexing of Json arrays is &#039;&#039;&#039;not&#039;&#039;&#039; supported.&lt;br /&gt;
&lt;br /&gt;
If an existing &amp;quot;Key&amp;quot; is {{LSLPT|specifiers}} at that level, its Value will be overwritten by {{LSLPT|value}} unless {{LSLPT|value}} is the magic value [[JSON_DELETE]]. If a value does not exist at {{LSLPT|specifiers}}, a new Key:Value pair will be formed within the Json object. &lt;br /&gt;
&lt;br /&gt;
To delete an existing value at {{LSLPT|specifiers}}, use [[JSON_DELETE]] as the {{LSLPT|value}}. Note it will not prune empty objects or arrays at higher levels.&lt;br /&gt;
&lt;br /&gt;
If {{LSLPT|value}} is [[JSON_TRUE]], [[JSON_FALSE]] or [[JSON_NULL]], the Value set will be the bare words &#039;true&#039;, &#039;false&#039; or &#039;null&#039;, respectively, at the {{LSLPT|specifiers}} location within {{LSLPT|json}}.&lt;br /&gt;
|return_text=&lt;br /&gt;
|spec=See [[Json_usage_in_LSL]]&lt;br /&gt;
|constants&lt;br /&gt;
|examples=&lt;br /&gt;
&amp;lt;source lang=&amp;quot;lsl2&amp;quot;&amp;gt;&lt;br /&gt;
string TEST_STRING_JSON;&lt;br /&gt;
&lt;br /&gt;
init()&lt;br /&gt;
{&lt;br /&gt;
    TEST_STRING_JSON = &amp;quot;[9,\&amp;quot;&amp;lt;1,1,1&amp;gt;\&amp;quot;,false,{\&amp;quot;A\&amp;quot;:8,\&amp;quot;Z\&amp;quot;:9}]&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;Original TEST_STRING_JSON: &amp;quot; + TEST_STRING_JSON);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
run_json_test(string input)&lt;br /&gt;
{&lt;br /&gt;
    string output;&lt;br /&gt;
&lt;br /&gt;
//  changing values within the json string&lt;br /&gt;
&lt;br /&gt;
//  change the first value in the array to 10&lt;br /&gt;
    output = llJsonSetValue(input, [0], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [10,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;( 1): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  change the third value in the array to &#039;true&#039;&lt;br /&gt;
    output = llJsonSetValue(input, [2], JSON_TRUE);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,true,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;( 2): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  change the value of &amp;quot;A&amp;quot; within the Json object to 3&lt;br /&gt;
    output = llJsonSetValue(input, [3, &amp;quot;A&amp;quot;], &amp;quot;3&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:3,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;( 3): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  adding a value or new key-value-pair within the input&lt;br /&gt;
&lt;br /&gt;
//  add the value &amp;quot;Hello&amp;quot; to the end of the array&lt;br /&gt;
//      NOTE: One cannot insert, only add to the end&lt;br /&gt;
    output = llJsonSetValue(input, [JSON_APPEND], &amp;quot;Hello&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9},&amp;quot;Hello&amp;quot;]&lt;br /&gt;
    say(&amp;quot;( 4): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  add the key-value-pair &amp;quot;B&amp;quot;:10 to the object&lt;br /&gt;
    output = llJsonSetValue(input, [3, &amp;quot;B&amp;quot;], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;B&amp;quot;:10,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;( 5): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//  Things to look out for when modifying Json text&lt;br /&gt;
//      ~!~ Be careful when using this function ~!~&lt;br /&gt;
&lt;br /&gt;
//  out of bounds array assignment:&lt;br /&gt;
//      defined as attempting to add a value to a position ...&lt;br /&gt;
//      ...greater than the length of the array (which may be 0)&lt;br /&gt;
//      JSON_APPEND is ALWAYS the preferred way to add to an array&lt;br /&gt;
    output = llJsonSetValue(input, [5], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  %EF%B7%90 (URL escaped JSON_INVALID)&lt;br /&gt;
    say(&amp;quot;( 6): &amp;quot; + llEscapeURL(output));&lt;br /&gt;
&lt;br /&gt;
//  BUT, this works, since it is in bounds&lt;br /&gt;
//      (eqivalent to JSON_APPEND in this case)&lt;br /&gt;
    output = llJsonSetValue(input, [4], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9},10]&lt;br /&gt;
    say(&amp;quot;( 7): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  careless formation of new arrays&lt;br /&gt;
//      ( the 4 and all subsequent 0&#039;s are all in bounds.)&lt;br /&gt;
    output = llJsonSetValue(input, [4, 0, 0, 0], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9},[[[10]]]]&lt;br /&gt;
    say(&amp;quot;( 8): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  overwriting an object with an array:&lt;br /&gt;
//      ~!~ mistaken use of JSON_APPEND on an object ~!~&lt;br /&gt;
    output = llJsonSetValue(input, [3, JSON_APPEND], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,[10]]&lt;br /&gt;
    say(&amp;quot;( 9): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  careless formation of new objects&lt;br /&gt;
//      NOTE: &amp;quot;Key&amp;quot; assignemts will NEVER result in a return of JSON_INVALID!&lt;br /&gt;
    output = llJsonSetValue(input, [3, &amp;quot;W&amp;quot;, &amp;quot;X&amp;quot;], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;W&amp;quot;:{&amp;quot;X&amp;quot;:10},&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;(10): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
    output = llJsonSetValue(input, [3, &amp;quot;W&amp;quot;, &amp;quot;X&amp;quot;, &amp;quot;Y&amp;quot;], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;W&amp;quot;:{&amp;quot;X&amp;quot;:{&amp;quot;Y&amp;quot;:10}},&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;(11): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  overwriting an array with an object&lt;br /&gt;
    output = llJsonSetValue(input, [&amp;quot;X&amp;quot;], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  {&amp;quot;X&amp;quot;:10}&lt;br /&gt;
    say(&amp;quot;(12): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  special case considerations:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//  BUG-3692: (NOTE: Corrected in release 13.09.21.281328!)&lt;br /&gt;
//      a bug where, instead of JSON_INVALID being returned, if the out of&lt;br /&gt;
//      bounds index is at a lower level than the topmost (root) level, a&lt;br /&gt;
//      non-compliant JSON text would be formed&lt;br /&gt;
    output = llJsonSetValue(input, [1, 7], &amp;quot;Disappearing Text&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  Note the &amp;quot;empty&amp;quot; second position that resulted in the returned array&lt;br /&gt;
//  [9,,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
// (But now correctly shows JSON_INVALID)&lt;br /&gt;
    say(&amp;quot;(13): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  though there is no way to directly delete a key-value-pair &lt;br /&gt;
//  nor remove a value from an array,&lt;br /&gt;
//  the use of JSON_NULL may prove adequate&lt;br /&gt;
    output = llJsonSetValue(input, [3, &amp;quot;A&amp;quot;], JSON_NULL);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:null,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;(14): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  if a JSON text object has been formed with llList2Json()&lt;br /&gt;
//  that contains one or more duplicated &amp;quot;Keys&amp;quot;, (allowable&lt;br /&gt;
//  but NOT recommended!) ANY change&lt;br /&gt;
//  made to that object will correct the condition,&lt;br /&gt;
//  with all but the last such &amp;quot;Key&amp;quot; being removed&lt;br /&gt;
    output = llList2Json(JSON_OBJECT, [&amp;quot;A&amp;quot;, 1, &amp;quot;A&amp;quot;, 2, &amp;quot;A&amp;quot;, 3, &amp;quot;B&amp;quot;, 4, &amp;quot;B&amp;quot;, 4]);&lt;br /&gt;
&lt;br /&gt;
//  both Keys &amp;quot;A&amp;quot; and &amp;quot;B&amp;quot; are duplicated&lt;br /&gt;
//  {&amp;quot;A&amp;quot;:1,&amp;quot;A&amp;quot;:2,&amp;quot;A&amp;quot;:3,&amp;quot;B&amp;quot;:4,&amp;quot;B&amp;quot;:4}&lt;br /&gt;
    say(&amp;quot;(15): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  only the last value of the duplications is accessable though&lt;br /&gt;
&lt;br /&gt;
//  3&lt;br /&gt;
    say(&amp;quot;(16): &amp;quot; + llJsonGetValue(output, [&amp;quot;A&amp;quot;]));&lt;br /&gt;
&lt;br /&gt;
//  condition corrected by adding a key-value-pair...&lt;br /&gt;
&lt;br /&gt;
//  {&amp;quot;A&amp;quot;:3,&amp;quot;B&amp;quot;:4,&amp;quot;Z&amp;quot;:5}&lt;br /&gt;
    say(&amp;quot;(17): &amp;quot; + llJsonSetValue(output, [&amp;quot;Z&amp;quot;], &amp;quot;5&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
//  ... or by changing a value&lt;br /&gt;
&lt;br /&gt;
// {&amp;quot;A&amp;quot;:5,&amp;quot;B&amp;quot;:4}&lt;br /&gt;
    say(&amp;quot;(18): &amp;quot; + llJsonSetValue(output, [&amp;quot;A&amp;quot;], &amp;quot;5&amp;quot;));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
say(string message)&lt;br /&gt;
{&lt;br /&gt;
    llOwnerSay(message);&lt;br /&gt;
//  llRegionSayTo(llGetOwner(), PUBLIC_CHANNEL, message);&lt;br /&gt;
//  llWhisper(PUBLIC_CHANNEL, message);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    on_rez(integer start_param)&lt;br /&gt;
    {&lt;br /&gt;
        llResetScript();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        init();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    touch_end(integer num_detected)&lt;br /&gt;
    {&lt;br /&gt;
//      copy &#039;TEST_STRING_JSON&#039; from the following function call&lt;br /&gt;
//      to the string &#039;input&#039; in the function declaration&lt;br /&gt;
//      and run a test on &#039;input&#039; to not (!) modify &#039;TEST_STRING_JSON&#039;&lt;br /&gt;
//      but its copy instead&lt;br /&gt;
        run_json_test(TEST_STRING_JSON);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|caveats=&lt;br /&gt;
&lt;br /&gt;
JSON_DELETE does not work with json-objects only json-arrays, use JSON_NULL instead.&lt;br /&gt;
&lt;br /&gt;
llListReplaceList() is roughly 2,8x as fast in replacing a single value of a list than LlJsonSetValue() is to replace a single value in a json.&lt;br /&gt;
The length of the list/json are irrelevant here.&lt;br /&gt;
&lt;br /&gt;
|helpers&lt;br /&gt;
|also_functions={{LSL DefineRow||[[llList2Json]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llJson2List]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llJsonGetValue]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llJsonValueType]]|}}&lt;br /&gt;
|also_events&lt;br /&gt;
|also_tests&lt;br /&gt;
|also_articles={{LSL DefineRow||[[Typecast]]|}}&lt;br /&gt;
|notes=&lt;br /&gt;
|permission&lt;br /&gt;
|negative_index&lt;br /&gt;
|sort=JsonSetValue&lt;br /&gt;
|cat1=List&lt;br /&gt;
|cat2=String&lt;br /&gt;
|cat3=Data Conversion&lt;br /&gt;
|cat4=JSON&lt;br /&gt;
|history = Date of Release  [[ Release_Notes/Second_Life_Server/13#13.05.20.276191 | 20/05/2013 ]]&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Reconx86 Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LlJsonSetValue&amp;diff=1196306</id>
		<title>LlJsonSetValue</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LlJsonSetValue&amp;diff=1196306"/>
		<updated>2015-04-29T02:58:11Z</updated>

		<summary type="html">&lt;p&gt;Reconx86 Resident: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Function&lt;br /&gt;
|inject-2={{Issues/BUG-3692}}&lt;br /&gt;
|inject-3={{LSL_Function/negative index|false|specifiers|nc=*}}&lt;br /&gt;
|func_id=|func_sleep=0.0|func_energy=10.0&lt;br /&gt;
|func=llJsonSetValue&lt;br /&gt;
|return_type=string&lt;br /&gt;
|p1_type=string|p1_name=json|p1_desc=source JSON data&lt;br /&gt;
|p2_type=list|p2_name=specifiers|p2_desc=location of the of the value to be added, updated or deleted.&lt;br /&gt;
|p3_type=string|p3_name=value|p3_desc=new value or [[JSON_DELETE]] flag.|p3_hover=new value or JSON_DELETE flag.&lt;br /&gt;
|func_footnote&lt;br /&gt;
|func_desc=Returns, if successful, a new [http://json.org JSON] text &#039;&#039;string&#039;&#039; which is {{LSLPT|json}} with the value indicated by the {{LSLPT|specifiers}} list set to {{LSLPT|value}}.&lt;br /&gt;
&lt;br /&gt;
If unsuccessful (usually because of specifying an out of range array index) it returns [[JSON_INVALID]].&lt;br /&gt;
&lt;br /&gt;
An &amp;quot;out of range array index&amp;quot; is defined to be any Integer {{LSLPT|specifiers}} greater than the length of an existing array at that level within the Json text or greater than 0 (zero) at a level an array doesn&#039;t exist.&lt;br /&gt;
&lt;br /&gt;
A special {{LSLPT|specifiers}}, [[JSON_APPEND]], is accepted which appends the {{LSLPT|value}} to the end of the array at the {{LSLPT|specifiers}} level. Care should be taken- if that level is not an array, the existing Value there will be overwritten and replaced with an array containing {{LSLPT|value}} at it&#039;s first (0) index.&lt;br /&gt;
&lt;br /&gt;
Contrary to [[list]]s and [[string]]s, negative indexing of Json arrays is &#039;&#039;&#039;not&#039;&#039;&#039; supported.&lt;br /&gt;
&lt;br /&gt;
If an existing &amp;quot;Key&amp;quot; is {{LSLPT|specifiers}} at that level, its Value will be overwritten by {{LSLPT|value}} unless {{LSLPT|value}} is the magic value [[JSON_DELETE]]. If a value does not exist at {{LSLPT|specifiers}}, a new Key:Value pair will be formed within the Json object. &lt;br /&gt;
&lt;br /&gt;
To delete an existing value at {{LSLPT|specifiers}}, use [[JSON_DELETE]] as the {{LSLPT|value}}. Note it will not prune empty objects or arrays at higher levels.&lt;br /&gt;
&lt;br /&gt;
If {{LSLPT|value}} is [[JSON_TRUE]], [[JSON_FALSE]] or [[JSON_NULL]], the Value set will be the bare words &#039;true&#039;, &#039;false&#039; or &#039;null&#039;, respectively, at the {{LSLPT|specifiers}} location within {{LSLPT|json}}.&lt;br /&gt;
|return_text=&lt;br /&gt;
|spec=See [[Json_usage_in_LSL]]&lt;br /&gt;
|constants&lt;br /&gt;
|examples=&lt;br /&gt;
&amp;lt;source lang=&amp;quot;lsl2&amp;quot;&amp;gt;&lt;br /&gt;
string TEST_STRING_JSON;&lt;br /&gt;
&lt;br /&gt;
init()&lt;br /&gt;
{&lt;br /&gt;
    TEST_STRING_JSON = &amp;quot;[9,\&amp;quot;&amp;lt;1,1,1&amp;gt;\&amp;quot;,false,{\&amp;quot;A\&amp;quot;:8,\&amp;quot;Z\&amp;quot;:9}]&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;Original TEST_STRING_JSON: &amp;quot; + TEST_STRING_JSON);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
run_json_test(string input)&lt;br /&gt;
{&lt;br /&gt;
    string output;&lt;br /&gt;
&lt;br /&gt;
//  changing values within the json string&lt;br /&gt;
&lt;br /&gt;
//  change the first value in the array to 10&lt;br /&gt;
    output = llJsonSetValue(input, [0], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [10,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;( 1): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  change the third value in the array to &#039;true&#039;&lt;br /&gt;
    output = llJsonSetValue(input, [2], JSON_TRUE);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,true,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;( 2): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  change the value of &amp;quot;A&amp;quot; within the Json object to 3&lt;br /&gt;
    output = llJsonSetValue(input, [3, &amp;quot;A&amp;quot;], &amp;quot;3&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:3,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;( 3): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  adding a value or new key-value-pair within the input&lt;br /&gt;
&lt;br /&gt;
//  add the value &amp;quot;Hello&amp;quot; to the end of the array&lt;br /&gt;
//      NOTE: One cannot insert, only add to the end&lt;br /&gt;
    output = llJsonSetValue(input, [JSON_APPEND], &amp;quot;Hello&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9},&amp;quot;Hello&amp;quot;]&lt;br /&gt;
    say(&amp;quot;( 4): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  add the key-value-pair &amp;quot;B&amp;quot;:10 to the object&lt;br /&gt;
    output = llJsonSetValue(input, [3, &amp;quot;B&amp;quot;], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;B&amp;quot;:10,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;( 5): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//  Things to look out for when modifying Json text&lt;br /&gt;
//      ~!~ Be careful when using this function ~!~&lt;br /&gt;
&lt;br /&gt;
//  out of bounds array assignment:&lt;br /&gt;
//      defined as attempting to add a value to a position ...&lt;br /&gt;
//      ...greater than the length of the array (which may be 0)&lt;br /&gt;
//      JSON_APPEND is ALWAYS the preferred way to add to an array&lt;br /&gt;
    output = llJsonSetValue(input, [5], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  %EF%B7%90 (URL escaped JSON_INVALID)&lt;br /&gt;
    say(&amp;quot;( 6): &amp;quot; + llEscapeURL(output));&lt;br /&gt;
&lt;br /&gt;
//  BUT, this works, since it is in bounds&lt;br /&gt;
//      (eqivalent to JSON_APPEND in this case)&lt;br /&gt;
    output = llJsonSetValue(input, [4], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9},10]&lt;br /&gt;
    say(&amp;quot;( 7): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  careless formation of new arrays&lt;br /&gt;
//      ( the 4 and all subsequent 0&#039;s are all in bounds.)&lt;br /&gt;
    output = llJsonSetValue(input, [4, 0, 0, 0], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9},[[[10]]]]&lt;br /&gt;
    say(&amp;quot;( 8): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  overwriting an object with an array:&lt;br /&gt;
//      ~!~ mistaken use of JSON_APPEND on an object ~!~&lt;br /&gt;
    output = llJsonSetValue(input, [3, JSON_APPEND], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,[10]]&lt;br /&gt;
    say(&amp;quot;( 9): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  careless formation of new objects&lt;br /&gt;
//      NOTE: &amp;quot;Key&amp;quot; assignemts will NEVER result in a return of JSON_INVALID!&lt;br /&gt;
    output = llJsonSetValue(input, [3, &amp;quot;W&amp;quot;, &amp;quot;X&amp;quot;], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;W&amp;quot;:{&amp;quot;X&amp;quot;:10},&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;(10): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
    output = llJsonSetValue(input, [3, &amp;quot;W&amp;quot;, &amp;quot;X&amp;quot;, &amp;quot;Y&amp;quot;], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;W&amp;quot;:{&amp;quot;X&amp;quot;:{&amp;quot;Y&amp;quot;:10}},&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;(11): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  overwriting an array with an object&lt;br /&gt;
    output = llJsonSetValue(input, [&amp;quot;X&amp;quot;], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  {&amp;quot;X&amp;quot;:10}&lt;br /&gt;
    say(&amp;quot;(12): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  special case considerations:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//  BUG-3692: (NOTE: Corrected in release 13.09.21.281328!)&lt;br /&gt;
//      a bug where, instead of JSON_INVALID being returned, if the out of&lt;br /&gt;
//      bounds index is at a lower level than the topmost (root) level, a&lt;br /&gt;
//      non-compliant JSON text would be formed&lt;br /&gt;
    output = llJsonSetValue(input, [1, 7], &amp;quot;Disappearing Text&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  Note the &amp;quot;empty&amp;quot; second position that resulted in the returned array&lt;br /&gt;
//  [9,,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
// (But now correctly shows JSON_INVALID)&lt;br /&gt;
    say(&amp;quot;(13): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  though there is no way to directly delete a key-value-pair &lt;br /&gt;
//  nor remove a value from an array,&lt;br /&gt;
//  the use of JSON_NULL may prove adequate&lt;br /&gt;
    output = llJsonSetValue(input, [3, &amp;quot;A&amp;quot;], JSON_NULL);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:null,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;(14): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  if a JSON text object has been formed with llList2Json()&lt;br /&gt;
//  that contains one or more duplicated &amp;quot;Keys&amp;quot;, (allowable&lt;br /&gt;
//  but NOT recommended!) ANY change&lt;br /&gt;
//  made to that object will correct the condition,&lt;br /&gt;
//  with all but the last such &amp;quot;Key&amp;quot; being removed&lt;br /&gt;
    output = llList2Json(JSON_OBJECT, [&amp;quot;A&amp;quot;, 1, &amp;quot;A&amp;quot;, 2, &amp;quot;A&amp;quot;, 3, &amp;quot;B&amp;quot;, 4, &amp;quot;B&amp;quot;, 4]);&lt;br /&gt;
&lt;br /&gt;
//  both Keys &amp;quot;A&amp;quot; and &amp;quot;B&amp;quot; are duplicated&lt;br /&gt;
//  {&amp;quot;A&amp;quot;:1,&amp;quot;A&amp;quot;:2,&amp;quot;A&amp;quot;:3,&amp;quot;B&amp;quot;:4,&amp;quot;B&amp;quot;:4}&lt;br /&gt;
    say(&amp;quot;(15): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  only the last value of the duplications is accessable though&lt;br /&gt;
&lt;br /&gt;
//  3&lt;br /&gt;
    say(&amp;quot;(16): &amp;quot; + llJsonGetValue(output, [&amp;quot;A&amp;quot;]));&lt;br /&gt;
&lt;br /&gt;
//  condition corrected by adding a key-value-pair...&lt;br /&gt;
&lt;br /&gt;
//  {&amp;quot;A&amp;quot;:3,&amp;quot;B&amp;quot;:4,&amp;quot;Z&amp;quot;:5}&lt;br /&gt;
    say(&amp;quot;(17): &amp;quot; + llJsonSetValue(output, [&amp;quot;Z&amp;quot;], &amp;quot;5&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
//  ... or by changing a value&lt;br /&gt;
&lt;br /&gt;
// {&amp;quot;A&amp;quot;:5,&amp;quot;B&amp;quot;:4}&lt;br /&gt;
    say(&amp;quot;(18): &amp;quot; + llJsonSetValue(output, [&amp;quot;A&amp;quot;], &amp;quot;5&amp;quot;));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
say(string message)&lt;br /&gt;
{&lt;br /&gt;
    llOwnerSay(message);&lt;br /&gt;
//  llRegionSayTo(llGetOwner(), PUBLIC_CHANNEL, message);&lt;br /&gt;
//  llWhisper(PUBLIC_CHANNEL, message);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    on_rez(integer start_param)&lt;br /&gt;
    {&lt;br /&gt;
        llResetScript();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        init();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    touch_end(integer num_detected)&lt;br /&gt;
    {&lt;br /&gt;
//      copy &#039;TEST_STRING_JSON&#039; from the following function call&lt;br /&gt;
//      to the string &#039;input&#039; in the function declaration&lt;br /&gt;
//      and run a test on &#039;input&#039; to not (!) modify &#039;TEST_STRING_JSON&#039;&lt;br /&gt;
//      but its copy instead&lt;br /&gt;
        run_json_test(TEST_STRING_JSON);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|caveats=&lt;br /&gt;
&lt;br /&gt;
JSON_DELETE does not work on json-objects only on json-arrays, use JSON_NULL instead.&lt;br /&gt;
&lt;br /&gt;
llListReplaceList() is roughly 2,8x as fast in replacing a single value of a list than LlJsonSetValue() is to replace a single value in a json.&lt;br /&gt;
The length of the list/json are irrelevant here.&lt;br /&gt;
&lt;br /&gt;
|helpers&lt;br /&gt;
|also_functions={{LSL DefineRow||[[llList2Json]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llJson2List]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llJsonGetValue]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llJsonValueType]]|}}&lt;br /&gt;
|also_events&lt;br /&gt;
|also_tests&lt;br /&gt;
|also_articles={{LSL DefineRow||[[Typecast]]|}}&lt;br /&gt;
|notes=&lt;br /&gt;
|permission&lt;br /&gt;
|negative_index&lt;br /&gt;
|sort=JsonSetValue&lt;br /&gt;
|cat1=List&lt;br /&gt;
|cat2=String&lt;br /&gt;
|cat3=Data Conversion&lt;br /&gt;
|cat4=JSON&lt;br /&gt;
|history = Date of Release  [[ Release_Notes/Second_Life_Server/13#13.05.20.276191 | 20/05/2013 ]]&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Reconx86 Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LlJsonSetValue&amp;diff=1196305</id>
		<title>LlJsonSetValue</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LlJsonSetValue&amp;diff=1196305"/>
		<updated>2015-04-29T02:54:19Z</updated>

		<summary type="html">&lt;p&gt;Reconx86 Resident: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Function&lt;br /&gt;
|inject-2={{Issues/BUG-3692}}&lt;br /&gt;
|inject-3={{LSL_Function/negative index|false|specifiers|nc=*}}&lt;br /&gt;
|func_id=|func_sleep=0.0|func_energy=10.0&lt;br /&gt;
|func=llJsonSetValue&lt;br /&gt;
|return_type=string&lt;br /&gt;
|p1_type=string|p1_name=json|p1_desc=source JSON data&lt;br /&gt;
|p2_type=list|p2_name=specifiers|p2_desc=location of the of the value to be added, updated or deleted.&lt;br /&gt;
|p3_type=string|p3_name=value|p3_desc=new value or [[JSON_DELETE]] flag.|p3_hover=new value or JSON_DELETE flag.&lt;br /&gt;
|func_footnote&lt;br /&gt;
|func_desc=Returns, if successful, a new [http://json.org JSON] text &#039;&#039;string&#039;&#039; which is {{LSLPT|json}} with the value indicated by the {{LSLPT|specifiers}} list set to {{LSLPT|value}}.&lt;br /&gt;
&lt;br /&gt;
If unsuccessful (usually because of specifying an out of range array index) it returns [[JSON_INVALID]].&lt;br /&gt;
&lt;br /&gt;
An &amp;quot;out of range array index&amp;quot; is defined to be any Integer {{LSLPT|specifiers}} greater than the length of an existing array at that level within the Json text or greater than 0 (zero) at a level an array doesn&#039;t exist.&lt;br /&gt;
&lt;br /&gt;
A special {{LSLPT|specifiers}}, [[JSON_APPEND]], is accepted which appends the {{LSLPT|value}} to the end of the array at the {{LSLPT|specifiers}} level. Care should be taken- if that level is not an array, the existing Value there will be overwritten and replaced with an array containing {{LSLPT|value}} at it&#039;s first (0) index.&lt;br /&gt;
&lt;br /&gt;
Contrary to [[list]]s and [[string]]s, negative indexing of Json arrays is &#039;&#039;&#039;not&#039;&#039;&#039; supported.&lt;br /&gt;
&lt;br /&gt;
If an existing &amp;quot;Key&amp;quot; is {{LSLPT|specifiers}} at that level, its Value will be overwritten by {{LSLPT|value}} unless {{LSLPT|value}} is the magic value [[JSON_DELETE]]. If a value does not exist at {{LSLPT|specifiers}}, a new Key:Value pair will be formed within the Json object. &lt;br /&gt;
&lt;br /&gt;
To delete an existing value at {{LSLPT|specifiers}}, use [[JSON_DELETE]] as the {{LSLPT|value}}. Note it will not prune empty objects or arrays at higher levels.&lt;br /&gt;
&lt;br /&gt;
If {{LSLPT|value}} is [[JSON_TRUE]], [[JSON_FALSE]] or [[JSON_NULL]], the Value set will be the bare words &#039;true&#039;, &#039;false&#039; or &#039;null&#039;, respectively, at the {{LSLPT|specifiers}} location within {{LSLPT|json}}.&lt;br /&gt;
|return_text=&lt;br /&gt;
|spec=See [[Json_usage_in_LSL]]&lt;br /&gt;
|constants&lt;br /&gt;
|examples=&lt;br /&gt;
&amp;lt;source lang=&amp;quot;lsl2&amp;quot;&amp;gt;&lt;br /&gt;
string TEST_STRING_JSON;&lt;br /&gt;
&lt;br /&gt;
init()&lt;br /&gt;
{&lt;br /&gt;
    TEST_STRING_JSON = &amp;quot;[9,\&amp;quot;&amp;lt;1,1,1&amp;gt;\&amp;quot;,false,{\&amp;quot;A\&amp;quot;:8,\&amp;quot;Z\&amp;quot;:9}]&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;Original TEST_STRING_JSON: &amp;quot; + TEST_STRING_JSON);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
run_json_test(string input)&lt;br /&gt;
{&lt;br /&gt;
    string output;&lt;br /&gt;
&lt;br /&gt;
//  changing values within the json string&lt;br /&gt;
&lt;br /&gt;
//  change the first value in the array to 10&lt;br /&gt;
    output = llJsonSetValue(input, [0], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [10,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;( 1): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  change the third value in the array to &#039;true&#039;&lt;br /&gt;
    output = llJsonSetValue(input, [2], JSON_TRUE);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,true,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;( 2): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  change the value of &amp;quot;A&amp;quot; within the Json object to 3&lt;br /&gt;
    output = llJsonSetValue(input, [3, &amp;quot;A&amp;quot;], &amp;quot;3&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:3,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;( 3): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  adding a value or new key-value-pair within the input&lt;br /&gt;
&lt;br /&gt;
//  add the value &amp;quot;Hello&amp;quot; to the end of the array&lt;br /&gt;
//      NOTE: One cannot insert, only add to the end&lt;br /&gt;
    output = llJsonSetValue(input, [JSON_APPEND], &amp;quot;Hello&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9},&amp;quot;Hello&amp;quot;]&lt;br /&gt;
    say(&amp;quot;( 4): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  add the key-value-pair &amp;quot;B&amp;quot;:10 to the object&lt;br /&gt;
    output = llJsonSetValue(input, [3, &amp;quot;B&amp;quot;], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;B&amp;quot;:10,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;( 5): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//  Things to look out for when modifying Json text&lt;br /&gt;
//      ~!~ Be careful when using this function ~!~&lt;br /&gt;
&lt;br /&gt;
//  out of bounds array assignment:&lt;br /&gt;
//      defined as attempting to add a value to a position ...&lt;br /&gt;
//      ...greater than the length of the array (which may be 0)&lt;br /&gt;
//      JSON_APPEND is ALWAYS the preferred way to add to an array&lt;br /&gt;
    output = llJsonSetValue(input, [5], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  %EF%B7%90 (URL escaped JSON_INVALID)&lt;br /&gt;
    say(&amp;quot;( 6): &amp;quot; + llEscapeURL(output));&lt;br /&gt;
&lt;br /&gt;
//  BUT, this works, since it is in bounds&lt;br /&gt;
//      (eqivalent to JSON_APPEND in this case)&lt;br /&gt;
    output = llJsonSetValue(input, [4], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9},10]&lt;br /&gt;
    say(&amp;quot;( 7): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  careless formation of new arrays&lt;br /&gt;
//      ( the 4 and all subsequent 0&#039;s are all in bounds.)&lt;br /&gt;
    output = llJsonSetValue(input, [4, 0, 0, 0], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9},[[[10]]]]&lt;br /&gt;
    say(&amp;quot;( 8): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  overwriting an object with an array:&lt;br /&gt;
//      ~!~ mistaken use of JSON_APPEND on an object ~!~&lt;br /&gt;
    output = llJsonSetValue(input, [3, JSON_APPEND], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,[10]]&lt;br /&gt;
    say(&amp;quot;( 9): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  careless formation of new objects&lt;br /&gt;
//      NOTE: &amp;quot;Key&amp;quot; assignemts will NEVER result in a return of JSON_INVALID!&lt;br /&gt;
    output = llJsonSetValue(input, [3, &amp;quot;W&amp;quot;, &amp;quot;X&amp;quot;], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;W&amp;quot;:{&amp;quot;X&amp;quot;:10},&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;(10): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
    output = llJsonSetValue(input, [3, &amp;quot;W&amp;quot;, &amp;quot;X&amp;quot;, &amp;quot;Y&amp;quot;], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;W&amp;quot;:{&amp;quot;X&amp;quot;:{&amp;quot;Y&amp;quot;:10}},&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;(11): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  overwriting an array with an object&lt;br /&gt;
    output = llJsonSetValue(input, [&amp;quot;X&amp;quot;], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  {&amp;quot;X&amp;quot;:10}&lt;br /&gt;
    say(&amp;quot;(12): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  special case considerations:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//  BUG-3692: (NOTE: Corrected in release 13.09.21.281328!)&lt;br /&gt;
//      a bug where, instead of JSON_INVALID being returned, if the out of&lt;br /&gt;
//      bounds index is at a lower level than the topmost (root) level, a&lt;br /&gt;
//      non-compliant JSON text would be formed&lt;br /&gt;
    output = llJsonSetValue(input, [1, 7], &amp;quot;Disappearing Text&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  Note the &amp;quot;empty&amp;quot; second position that resulted in the returned array&lt;br /&gt;
//  [9,,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
// (But now correctly shows JSON_INVALID)&lt;br /&gt;
    say(&amp;quot;(13): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  though there is no way to directly delete a key-value-pair &lt;br /&gt;
//  nor remove a value from an array,&lt;br /&gt;
//  the use of JSON_NULL may prove adequate&lt;br /&gt;
    output = llJsonSetValue(input, [3, &amp;quot;A&amp;quot;], JSON_NULL);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:null,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;(14): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  if a JSON text object has been formed with llList2Json()&lt;br /&gt;
//  that contains one or more duplicated &amp;quot;Keys&amp;quot;, (allowable&lt;br /&gt;
//  but NOT recommended!) ANY change&lt;br /&gt;
//  made to that object will correct the condition,&lt;br /&gt;
//  with all but the last such &amp;quot;Key&amp;quot; being removed&lt;br /&gt;
    output = llList2Json(JSON_OBJECT, [&amp;quot;A&amp;quot;, 1, &amp;quot;A&amp;quot;, 2, &amp;quot;A&amp;quot;, 3, &amp;quot;B&amp;quot;, 4, &amp;quot;B&amp;quot;, 4]);&lt;br /&gt;
&lt;br /&gt;
//  both Keys &amp;quot;A&amp;quot; and &amp;quot;B&amp;quot; are duplicated&lt;br /&gt;
//  {&amp;quot;A&amp;quot;:1,&amp;quot;A&amp;quot;:2,&amp;quot;A&amp;quot;:3,&amp;quot;B&amp;quot;:4,&amp;quot;B&amp;quot;:4}&lt;br /&gt;
    say(&amp;quot;(15): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  only the last value of the duplications is accessable though&lt;br /&gt;
&lt;br /&gt;
//  3&lt;br /&gt;
    say(&amp;quot;(16): &amp;quot; + llJsonGetValue(output, [&amp;quot;A&amp;quot;]));&lt;br /&gt;
&lt;br /&gt;
//  condition corrected by adding a key-value-pair...&lt;br /&gt;
&lt;br /&gt;
//  {&amp;quot;A&amp;quot;:3,&amp;quot;B&amp;quot;:4,&amp;quot;Z&amp;quot;:5}&lt;br /&gt;
    say(&amp;quot;(17): &amp;quot; + llJsonSetValue(output, [&amp;quot;Z&amp;quot;], &amp;quot;5&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
//  ... or by changing a value&lt;br /&gt;
&lt;br /&gt;
// {&amp;quot;A&amp;quot;:5,&amp;quot;B&amp;quot;:4}&lt;br /&gt;
    say(&amp;quot;(18): &amp;quot; + llJsonSetValue(output, [&amp;quot;A&amp;quot;], &amp;quot;5&amp;quot;));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
say(string message)&lt;br /&gt;
{&lt;br /&gt;
    llOwnerSay(message);&lt;br /&gt;
//  llRegionSayTo(llGetOwner(), PUBLIC_CHANNEL, message);&lt;br /&gt;
//  llWhisper(PUBLIC_CHANNEL, message);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    on_rez(integer start_param)&lt;br /&gt;
    {&lt;br /&gt;
        llResetScript();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        init();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    touch_end(integer num_detected)&lt;br /&gt;
    {&lt;br /&gt;
//      copy &#039;TEST_STRING_JSON&#039; from the following function call&lt;br /&gt;
//      to the string &#039;input&#039; in the function declaration&lt;br /&gt;
//      and run a test on &#039;input&#039; to not (!) modify &#039;TEST_STRING_JSON&#039;&lt;br /&gt;
//      but its copy instead&lt;br /&gt;
        run_json_test(TEST_STRING_JSON);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|caveats=&lt;br /&gt;
&lt;br /&gt;
JSON_DELETE does not work on key-value pairs only json-arrays, use JSON_NULL instead.&lt;br /&gt;
&lt;br /&gt;
llListReplaceList() is roughly 2,8x as fast in replacing a single value of a list than LlJsonSetValue() is to replace a single value in a json.&lt;br /&gt;
The length of the list/json are irrelevant here.&lt;br /&gt;
&lt;br /&gt;
|helpers&lt;br /&gt;
|also_functions={{LSL DefineRow||[[llList2Json]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llJson2List]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llJsonGetValue]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llJsonValueType]]|}}&lt;br /&gt;
|also_events&lt;br /&gt;
|also_tests&lt;br /&gt;
|also_articles={{LSL DefineRow||[[Typecast]]|}}&lt;br /&gt;
|notes=&lt;br /&gt;
|permission&lt;br /&gt;
|negative_index&lt;br /&gt;
|sort=JsonSetValue&lt;br /&gt;
|cat1=List&lt;br /&gt;
|cat2=String&lt;br /&gt;
|cat3=Data Conversion&lt;br /&gt;
|cat4=JSON&lt;br /&gt;
|history = Date of Release  [[ Release_Notes/Second_Life_Server/13#13.05.20.276191 | 20/05/2013 ]]&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Reconx86 Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LlJsonSetValue&amp;diff=1196304</id>
		<title>LlJsonSetValue</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LlJsonSetValue&amp;diff=1196304"/>
		<updated>2015-04-29T02:50:57Z</updated>

		<summary type="html">&lt;p&gt;Reconx86 Resident: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Function&lt;br /&gt;
|inject-2={{Issues/BUG-3692}}&lt;br /&gt;
|inject-3={{LSL_Function/negative index|false|specifiers|nc=*}}&lt;br /&gt;
|func_id=|func_sleep=0.0|func_energy=10.0&lt;br /&gt;
|func=llJsonSetValue&lt;br /&gt;
|return_type=string&lt;br /&gt;
|p1_type=string|p1_name=json|p1_desc=source JSON data&lt;br /&gt;
|p2_type=list|p2_name=specifiers|p2_desc=location of the of the value to be added, updated or deleted.&lt;br /&gt;
|p3_type=string|p3_name=value|p3_desc=new value or [[JSON_DELETE]] flag.|p3_hover=new value or JSON_DELETE flag.&lt;br /&gt;
|func_footnote&lt;br /&gt;
|func_desc=Returns, if successful, a new [http://json.org JSON] text &#039;&#039;string&#039;&#039; which is {{LSLPT|json}} with the value indicated by the {{LSLPT|specifiers}} list set to {{LSLPT|value}}.&lt;br /&gt;
&lt;br /&gt;
If unsuccessful (usually because of specifying an out of range array index) it returns [[JSON_INVALID]].&lt;br /&gt;
&lt;br /&gt;
An &amp;quot;out of range array index&amp;quot; is defined to be any Integer {{LSLPT|specifiers}} greater than the length of an existing array at that level within the Json text or greater than 0 (zero) at a level an array doesn&#039;t exist.&lt;br /&gt;
&lt;br /&gt;
A special {{LSLPT|specifiers}}, [[JSON_APPEND]], is accepted which appends the {{LSLPT|value}} to the end of the array at the {{LSLPT|specifiers}} level. Care should be taken- if that level is not an array, the existing Value there will be overwritten and replaced with an array containing {{LSLPT|value}} at it&#039;s first (0) index.&lt;br /&gt;
&lt;br /&gt;
Contrary to [[list]]s and [[string]]s, negative indexing of Json arrays is &#039;&#039;&#039;not&#039;&#039;&#039; supported.&lt;br /&gt;
&lt;br /&gt;
If an existing &amp;quot;Key&amp;quot; is {{LSLPT|specifiers}} at that level, its Value will be overwritten by {{LSLPT|value}} unless {{LSLPT|value}} is the magic value [[JSON_DELETE]]. If a value does not exist at {{LSLPT|specifiers}}, a new Key:Value pair will be formed within the Json object. &lt;br /&gt;
&lt;br /&gt;
To delete an existing value at {{LSLPT|specifiers}}, use [[JSON_DELETE]] as the {{LSLPT|value}}. Note it will not prune empty objects or arrays at higher levels.&lt;br /&gt;
&lt;br /&gt;
If {{LSLPT|value}} is [[JSON_TRUE]], [[JSON_FALSE]] or [[JSON_NULL]], the Value set will be the bare words &#039;true&#039;, &#039;false&#039; or &#039;null&#039;, respectively, at the {{LSLPT|specifiers}} location within {{LSLPT|json}}.&lt;br /&gt;
|return_text=&lt;br /&gt;
|spec=See [[Json_usage_in_LSL]]&lt;br /&gt;
|constants&lt;br /&gt;
|examples=&lt;br /&gt;
&amp;lt;source lang=&amp;quot;lsl2&amp;quot;&amp;gt;&lt;br /&gt;
string TEST_STRING_JSON;&lt;br /&gt;
&lt;br /&gt;
init()&lt;br /&gt;
{&lt;br /&gt;
    TEST_STRING_JSON = &amp;quot;[9,\&amp;quot;&amp;lt;1,1,1&amp;gt;\&amp;quot;,false,{\&amp;quot;A\&amp;quot;:8,\&amp;quot;Z\&amp;quot;:9}]&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;Original TEST_STRING_JSON: &amp;quot; + TEST_STRING_JSON);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
run_json_test(string input)&lt;br /&gt;
{&lt;br /&gt;
    string output;&lt;br /&gt;
&lt;br /&gt;
//  changing values within the json string&lt;br /&gt;
&lt;br /&gt;
//  change the first value in the array to 10&lt;br /&gt;
    output = llJsonSetValue(input, [0], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [10,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;( 1): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  change the third value in the array to &#039;true&#039;&lt;br /&gt;
    output = llJsonSetValue(input, [2], JSON_TRUE);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,true,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;( 2): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  change the value of &amp;quot;A&amp;quot; within the Json object to 3&lt;br /&gt;
    output = llJsonSetValue(input, [3, &amp;quot;A&amp;quot;], &amp;quot;3&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:3,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;( 3): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  adding a value or new key-value-pair within the input&lt;br /&gt;
&lt;br /&gt;
//  add the value &amp;quot;Hello&amp;quot; to the end of the array&lt;br /&gt;
//      NOTE: One cannot insert, only add to the end&lt;br /&gt;
    output = llJsonSetValue(input, [JSON_APPEND], &amp;quot;Hello&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9},&amp;quot;Hello&amp;quot;]&lt;br /&gt;
    say(&amp;quot;( 4): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  add the key-value-pair &amp;quot;B&amp;quot;:10 to the object&lt;br /&gt;
    output = llJsonSetValue(input, [3, &amp;quot;B&amp;quot;], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;B&amp;quot;:10,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;( 5): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//  Things to look out for when modifying Json text&lt;br /&gt;
//      ~!~ Be careful when using this function ~!~&lt;br /&gt;
&lt;br /&gt;
//  out of bounds array assignment:&lt;br /&gt;
//      defined as attempting to add a value to a position ...&lt;br /&gt;
//      ...greater than the length of the array (which may be 0)&lt;br /&gt;
//      JSON_APPEND is ALWAYS the preferred way to add to an array&lt;br /&gt;
    output = llJsonSetValue(input, [5], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  %EF%B7%90 (URL escaped JSON_INVALID)&lt;br /&gt;
    say(&amp;quot;( 6): &amp;quot; + llEscapeURL(output));&lt;br /&gt;
&lt;br /&gt;
//  BUT, this works, since it is in bounds&lt;br /&gt;
//      (eqivalent to JSON_APPEND in this case)&lt;br /&gt;
    output = llJsonSetValue(input, [4], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9},10]&lt;br /&gt;
    say(&amp;quot;( 7): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  careless formation of new arrays&lt;br /&gt;
//      ( the 4 and all subsequent 0&#039;s are all in bounds.)&lt;br /&gt;
    output = llJsonSetValue(input, [4, 0, 0, 0], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9},[[[10]]]]&lt;br /&gt;
    say(&amp;quot;( 8): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  overwriting an object with an array:&lt;br /&gt;
//      ~!~ mistaken use of JSON_APPEND on an object ~!~&lt;br /&gt;
    output = llJsonSetValue(input, [3, JSON_APPEND], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,[10]]&lt;br /&gt;
    say(&amp;quot;( 9): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  careless formation of new objects&lt;br /&gt;
//      NOTE: &amp;quot;Key&amp;quot; assignemts will NEVER result in a return of JSON_INVALID!&lt;br /&gt;
    output = llJsonSetValue(input, [3, &amp;quot;W&amp;quot;, &amp;quot;X&amp;quot;], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;W&amp;quot;:{&amp;quot;X&amp;quot;:10},&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;(10): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
    output = llJsonSetValue(input, [3, &amp;quot;W&amp;quot;, &amp;quot;X&amp;quot;, &amp;quot;Y&amp;quot;], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;W&amp;quot;:{&amp;quot;X&amp;quot;:{&amp;quot;Y&amp;quot;:10}},&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;(11): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  overwriting an array with an object&lt;br /&gt;
    output = llJsonSetValue(input, [&amp;quot;X&amp;quot;], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  {&amp;quot;X&amp;quot;:10}&lt;br /&gt;
    say(&amp;quot;(12): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  special case considerations:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//  BUG-3692: (NOTE: Corrected in release 13.09.21.281328!)&lt;br /&gt;
//      a bug where, instead of JSON_INVALID being returned, if the out of&lt;br /&gt;
//      bounds index is at a lower level than the topmost (root) level, a&lt;br /&gt;
//      non-compliant JSON text would be formed&lt;br /&gt;
    output = llJsonSetValue(input, [1, 7], &amp;quot;Disappearing Text&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  Note the &amp;quot;empty&amp;quot; second position that resulted in the returned array&lt;br /&gt;
//  [9,,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
// (But now correctly shows JSON_INVALID)&lt;br /&gt;
    say(&amp;quot;(13): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  though there is no way to directly delete a key-value-pair &lt;br /&gt;
//  nor remove a value from an array,&lt;br /&gt;
//  the use of JSON_NULL may prove adequate&lt;br /&gt;
    output = llJsonSetValue(input, [3, &amp;quot;A&amp;quot;], JSON_NULL);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:null,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;(14): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  if a JSON text object has been formed with llList2Json()&lt;br /&gt;
//  that contains one or more duplicated &amp;quot;Keys&amp;quot;, (allowable&lt;br /&gt;
//  but NOT recommended!) ANY change&lt;br /&gt;
//  made to that object will correct the condition,&lt;br /&gt;
//  with all but the last such &amp;quot;Key&amp;quot; being removed&lt;br /&gt;
    output = llList2Json(JSON_OBJECT, [&amp;quot;A&amp;quot;, 1, &amp;quot;A&amp;quot;, 2, &amp;quot;A&amp;quot;, 3, &amp;quot;B&amp;quot;, 4, &amp;quot;B&amp;quot;, 4]);&lt;br /&gt;
&lt;br /&gt;
//  both Keys &amp;quot;A&amp;quot; and &amp;quot;B&amp;quot; are duplicated&lt;br /&gt;
//  {&amp;quot;A&amp;quot;:1,&amp;quot;A&amp;quot;:2,&amp;quot;A&amp;quot;:3,&amp;quot;B&amp;quot;:4,&amp;quot;B&amp;quot;:4}&lt;br /&gt;
    say(&amp;quot;(15): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  only the last value of the duplications is accessable though&lt;br /&gt;
&lt;br /&gt;
//  3&lt;br /&gt;
    say(&amp;quot;(16): &amp;quot; + llJsonGetValue(output, [&amp;quot;A&amp;quot;]));&lt;br /&gt;
&lt;br /&gt;
//  condition corrected by adding a key-value-pair...&lt;br /&gt;
&lt;br /&gt;
//  {&amp;quot;A&amp;quot;:3,&amp;quot;B&amp;quot;:4,&amp;quot;Z&amp;quot;:5}&lt;br /&gt;
    say(&amp;quot;(17): &amp;quot; + llJsonSetValue(output, [&amp;quot;Z&amp;quot;], &amp;quot;5&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
//  ... or by changing a value&lt;br /&gt;
&lt;br /&gt;
// {&amp;quot;A&amp;quot;:5,&amp;quot;B&amp;quot;:4}&lt;br /&gt;
    say(&amp;quot;(18): &amp;quot; + llJsonSetValue(output, [&amp;quot;A&amp;quot;], &amp;quot;5&amp;quot;));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
say(string message)&lt;br /&gt;
{&lt;br /&gt;
    llOwnerSay(message);&lt;br /&gt;
//  llRegionSayTo(llGetOwner(), PUBLIC_CHANNEL, message);&lt;br /&gt;
//  llWhisper(PUBLIC_CHANNEL, message);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    on_rez(integer start_param)&lt;br /&gt;
    {&lt;br /&gt;
        llResetScript();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        init();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    touch_end(integer num_detected)&lt;br /&gt;
    {&lt;br /&gt;
//      copy &#039;TEST_STRING_JSON&#039; from the following function call&lt;br /&gt;
//      to the string &#039;input&#039; in the function declaration&lt;br /&gt;
//      and run a test on &#039;input&#039; to not (!) modify &#039;TEST_STRING_JSON&#039;&lt;br /&gt;
//      but its copy instead&lt;br /&gt;
        run_json_test(TEST_STRING_JSON);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|caveats=&lt;br /&gt;
&lt;br /&gt;
JSON_DELETE does not work on key-value pairs, only json-arrays&lt;br /&gt;
&lt;br /&gt;
llListReplaceList() is roughly 2,8x as fast in replacing a single value of a list than LlJsonSetValue() is to replace a single value in a json.&lt;br /&gt;
The length of the list/json are irrelevant here.&lt;br /&gt;
&lt;br /&gt;
|helpers&lt;br /&gt;
|also_functions={{LSL DefineRow||[[llList2Json]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llJson2List]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llJsonGetValue]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llJsonValueType]]|}}&lt;br /&gt;
|also_events&lt;br /&gt;
|also_tests&lt;br /&gt;
|also_articles={{LSL DefineRow||[[Typecast]]|}}&lt;br /&gt;
|notes=&lt;br /&gt;
|permission&lt;br /&gt;
|negative_index&lt;br /&gt;
|sort=JsonSetValue&lt;br /&gt;
|cat1=List&lt;br /&gt;
|cat2=String&lt;br /&gt;
|cat3=Data Conversion&lt;br /&gt;
|cat4=JSON&lt;br /&gt;
|history = Date of Release  [[ Release_Notes/Second_Life_Server/13#13.05.20.276191 | 20/05/2013 ]]&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Reconx86 Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LlJsonSetValue&amp;diff=1196303</id>
		<title>LlJsonSetValue</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LlJsonSetValue&amp;diff=1196303"/>
		<updated>2015-04-29T02:48:30Z</updated>

		<summary type="html">&lt;p&gt;Reconx86 Resident: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Function&lt;br /&gt;
|inject-2={{Issues/BUG-3692}}&lt;br /&gt;
|inject-3={{LSL_Function/negative index|false|specifiers|nc=*}}&lt;br /&gt;
|func_id=|func_sleep=0.0|func_energy=10.0&lt;br /&gt;
|func=llJsonSetValue&lt;br /&gt;
|return_type=string&lt;br /&gt;
|p1_type=string|p1_name=json|p1_desc=source JSON data&lt;br /&gt;
|p2_type=list|p2_name=specifiers|p2_desc=location of the of the value to be added, updated or deleted.&lt;br /&gt;
|p3_type=string|p3_name=value|p3_desc=new value or [[JSON_DELETE]] flag.|p3_hover=new value or JSON_DELETE flag.&lt;br /&gt;
|func_footnote&lt;br /&gt;
|func_desc=Returns, if successful, a new [http://json.org JSON] text &#039;&#039;string&#039;&#039; which is {{LSLPT|json}} with the value indicated by the {{LSLPT|specifiers}} list set to {{LSLPT|value}}.&lt;br /&gt;
&lt;br /&gt;
If unsuccessful (usually because of specifying an out of range array index) it returns [[JSON_INVALID]].&lt;br /&gt;
&lt;br /&gt;
An &amp;quot;out of range array index&amp;quot; is defined to be any Integer {{LSLPT|specifiers}} greater than the length of an existing array at that level within the Json text or greater than 0 (zero) at a level an array doesn&#039;t exist.&lt;br /&gt;
&lt;br /&gt;
A special {{LSLPT|specifiers}}, [[JSON_APPEND]], is accepted which appends the {{LSLPT|value}} to the end of the array at the {{LSLPT|specifiers}} level. Care should be taken- if that level is not an array, the existing Value there will be overwritten and replaced with an array containing {{LSLPT|value}} at it&#039;s first (0) index.&lt;br /&gt;
&lt;br /&gt;
Contrary to [[list]]s and [[string]]s, negative indexing of Json arrays is &#039;&#039;&#039;not&#039;&#039;&#039; supported.&lt;br /&gt;
&lt;br /&gt;
If an existing &amp;quot;Key&amp;quot; is {{LSLPT|specifiers}} at that level, its Value will be overwritten by {{LSLPT|value}} unless {{LSLPT|value}} is the magic value [[JSON_DELETE]]. If a value does not exist at {{LSLPT|specifiers}}, a new Key:Value pair will be formed within the Json object. &lt;br /&gt;
&lt;br /&gt;
To delete an existing value at {{LSLPT|specifiers}}, use [[JSON_DELETE]] as the {{LSLPT|value}}. Note it will not prune empty objects or arrays at higher levels.&lt;br /&gt;
&lt;br /&gt;
If {{LSLPT|value}} is [[JSON_TRUE]], [[JSON_FALSE]] or [[JSON_NULL]], the Value set will be the bare words &#039;true&#039;, &#039;false&#039; or &#039;null&#039;, respectively, at the {{LSLPT|specifiers}} location within {{LSLPT|json}}.&lt;br /&gt;
|return_text=&lt;br /&gt;
|spec=See [[Json_usage_in_LSL]]&lt;br /&gt;
|constants&lt;br /&gt;
|examples=&lt;br /&gt;
&amp;lt;source lang=&amp;quot;lsl2&amp;quot;&amp;gt;&lt;br /&gt;
string TEST_STRING_JSON;&lt;br /&gt;
&lt;br /&gt;
init()&lt;br /&gt;
{&lt;br /&gt;
    TEST_STRING_JSON = &amp;quot;[9,\&amp;quot;&amp;lt;1,1,1&amp;gt;\&amp;quot;,false,{\&amp;quot;A\&amp;quot;:8,\&amp;quot;Z\&amp;quot;:9}]&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;Original TEST_STRING_JSON: &amp;quot; + TEST_STRING_JSON);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
run_json_test(string input)&lt;br /&gt;
{&lt;br /&gt;
    string output;&lt;br /&gt;
&lt;br /&gt;
//  changing values within the json string&lt;br /&gt;
&lt;br /&gt;
//  change the first value in the array to 10&lt;br /&gt;
    output = llJsonSetValue(input, [0], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [10,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;( 1): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  change the third value in the array to &#039;true&#039;&lt;br /&gt;
    output = llJsonSetValue(input, [2], JSON_TRUE);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,true,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;( 2): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  change the value of &amp;quot;A&amp;quot; within the Json object to 3&lt;br /&gt;
    output = llJsonSetValue(input, [3, &amp;quot;A&amp;quot;], &amp;quot;3&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:3,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;( 3): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  adding a value or new key-value-pair within the input&lt;br /&gt;
&lt;br /&gt;
//  add the value &amp;quot;Hello&amp;quot; to the end of the array&lt;br /&gt;
//      NOTE: One cannot insert, only add to the end&lt;br /&gt;
    output = llJsonSetValue(input, [JSON_APPEND], &amp;quot;Hello&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9},&amp;quot;Hello&amp;quot;]&lt;br /&gt;
    say(&amp;quot;( 4): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  add the key-value-pair &amp;quot;B&amp;quot;:10 to the object&lt;br /&gt;
    output = llJsonSetValue(input, [3, &amp;quot;B&amp;quot;], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;B&amp;quot;:10,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;( 5): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//  Things to look out for when modifying Json text&lt;br /&gt;
//      ~!~ Be careful when using this function ~!~&lt;br /&gt;
&lt;br /&gt;
//  out of bounds array assignment:&lt;br /&gt;
//      defined as attempting to add a value to a position ...&lt;br /&gt;
//      ...greater than the length of the array (which may be 0)&lt;br /&gt;
//      JSON_APPEND is ALWAYS the preferred way to add to an array&lt;br /&gt;
    output = llJsonSetValue(input, [5], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  %EF%B7%90 (URL escaped JSON_INVALID)&lt;br /&gt;
    say(&amp;quot;( 6): &amp;quot; + llEscapeURL(output));&lt;br /&gt;
&lt;br /&gt;
//  BUT, this works, since it is in bounds&lt;br /&gt;
//      (eqivalent to JSON_APPEND in this case)&lt;br /&gt;
    output = llJsonSetValue(input, [4], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9},10]&lt;br /&gt;
    say(&amp;quot;( 7): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  careless formation of new arrays&lt;br /&gt;
//      ( the 4 and all subsequent 0&#039;s are all in bounds.)&lt;br /&gt;
    output = llJsonSetValue(input, [4, 0, 0, 0], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9},[[[10]]]]&lt;br /&gt;
    say(&amp;quot;( 8): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  overwriting an object with an array:&lt;br /&gt;
//      ~!~ mistaken use of JSON_APPEND on an object ~!~&lt;br /&gt;
    output = llJsonSetValue(input, [3, JSON_APPEND], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,[10]]&lt;br /&gt;
    say(&amp;quot;( 9): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  careless formation of new objects&lt;br /&gt;
//      NOTE: &amp;quot;Key&amp;quot; assignemts will NEVER result in a return of JSON_INVALID!&lt;br /&gt;
    output = llJsonSetValue(input, [3, &amp;quot;W&amp;quot;, &amp;quot;X&amp;quot;], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;W&amp;quot;:{&amp;quot;X&amp;quot;:10},&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;(10): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
    output = llJsonSetValue(input, [3, &amp;quot;W&amp;quot;, &amp;quot;X&amp;quot;, &amp;quot;Y&amp;quot;], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:8,&amp;quot;W&amp;quot;:{&amp;quot;X&amp;quot;:{&amp;quot;Y&amp;quot;:10}},&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;(11): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  overwriting an array with an object&lt;br /&gt;
    output = llJsonSetValue(input, [&amp;quot;X&amp;quot;], &amp;quot;10&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  {&amp;quot;X&amp;quot;:10}&lt;br /&gt;
    say(&amp;quot;(12): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  special case considerations:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//  BUG-3692: (NOTE: Corrected in release 13.09.21.281328!)&lt;br /&gt;
//      a bug where, instead of JSON_INVALID being returned, if the out of&lt;br /&gt;
//      bounds index is at a lower level than the topmost (root) level, a&lt;br /&gt;
//      non-compliant JSON text would be formed&lt;br /&gt;
    output = llJsonSetValue(input, [1, 7], &amp;quot;Disappearing Text&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//  Note the &amp;quot;empty&amp;quot; second position that resulted in the returned array&lt;br /&gt;
//  [9,,false,{&amp;quot;A&amp;quot;:8,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
// (But now correctly shows JSON_INVALID)&lt;br /&gt;
    say(&amp;quot;(13): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  though there is no way to directly delete a key-value-pair &lt;br /&gt;
//  nor remove a value from an array,&lt;br /&gt;
//  the use of JSON_NULL may prove adequate&lt;br /&gt;
    output = llJsonSetValue(input, [3, &amp;quot;A&amp;quot;], JSON_NULL);&lt;br /&gt;
&lt;br /&gt;
//  [9,&amp;quot;&amp;lt;1,1,1&amp;gt;&amp;quot;,false,{&amp;quot;A&amp;quot;:null,&amp;quot;Z&amp;quot;:9}]&lt;br /&gt;
    say(&amp;quot;(14): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  if a JSON text object has been formed with llList2Json()&lt;br /&gt;
//  that contains one or more duplicated &amp;quot;Keys&amp;quot;, (allowable&lt;br /&gt;
//  but NOT recommended!) ANY change&lt;br /&gt;
//  made to that object will correct the condition,&lt;br /&gt;
//  with all but the last such &amp;quot;Key&amp;quot; being removed&lt;br /&gt;
    output = llList2Json(JSON_OBJECT, [&amp;quot;A&amp;quot;, 1, &amp;quot;A&amp;quot;, 2, &amp;quot;A&amp;quot;, 3, &amp;quot;B&amp;quot;, 4, &amp;quot;B&amp;quot;, 4]);&lt;br /&gt;
&lt;br /&gt;
//  both Keys &amp;quot;A&amp;quot; and &amp;quot;B&amp;quot; are duplicated&lt;br /&gt;
//  {&amp;quot;A&amp;quot;:1,&amp;quot;A&amp;quot;:2,&amp;quot;A&amp;quot;:3,&amp;quot;B&amp;quot;:4,&amp;quot;B&amp;quot;:4}&lt;br /&gt;
    say(&amp;quot;(15): &amp;quot; + output);&lt;br /&gt;
&lt;br /&gt;
//  only the last value of the duplications is accessable though&lt;br /&gt;
&lt;br /&gt;
//  3&lt;br /&gt;
    say(&amp;quot;(16): &amp;quot; + llJsonGetValue(output, [&amp;quot;A&amp;quot;]));&lt;br /&gt;
&lt;br /&gt;
//  condition corrected by adding a key-value-pair...&lt;br /&gt;
&lt;br /&gt;
//  {&amp;quot;A&amp;quot;:3,&amp;quot;B&amp;quot;:4,&amp;quot;Z&amp;quot;:5}&lt;br /&gt;
    say(&amp;quot;(17): &amp;quot; + llJsonSetValue(output, [&amp;quot;Z&amp;quot;], &amp;quot;5&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
//  ... or by changing a value&lt;br /&gt;
&lt;br /&gt;
// {&amp;quot;A&amp;quot;:5,&amp;quot;B&amp;quot;:4}&lt;br /&gt;
    say(&amp;quot;(18): &amp;quot; + llJsonSetValue(output, [&amp;quot;A&amp;quot;], &amp;quot;5&amp;quot;));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
say(string message)&lt;br /&gt;
{&lt;br /&gt;
    llOwnerSay(message);&lt;br /&gt;
//  llRegionSayTo(llGetOwner(), PUBLIC_CHANNEL, message);&lt;br /&gt;
//  llWhisper(PUBLIC_CHANNEL, message);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    on_rez(integer start_param)&lt;br /&gt;
    {&lt;br /&gt;
        llResetScript();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        init();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    touch_end(integer num_detected)&lt;br /&gt;
    {&lt;br /&gt;
//      copy &#039;TEST_STRING_JSON&#039; from the following function call&lt;br /&gt;
//      to the string &#039;input&#039; in the function declaration&lt;br /&gt;
//      and run a test on &#039;input&#039; to not (!) modify &#039;TEST_STRING_JSON&#039;&lt;br /&gt;
//      but its copy instead&lt;br /&gt;
        run_json_test(TEST_STRING_JSON);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|caveats=&lt;br /&gt;
&lt;br /&gt;
llListReplaceList() is roughly 2,8x as fast in replacing a single value of a list than LlJsonSetValue() is to replace a single value in a json.&lt;br /&gt;
The length of the list/json are irrelevant here.&lt;br /&gt;
&lt;br /&gt;
JSON_DELETE does not work on key-value pairs, only json-arrays&lt;br /&gt;
&lt;br /&gt;
|helpers&lt;br /&gt;
|also_functions={{LSL DefineRow||[[llList2Json]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llJson2List]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llJsonGetValue]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llJsonValueType]]|}}&lt;br /&gt;
|also_events&lt;br /&gt;
|also_tests&lt;br /&gt;
|also_articles={{LSL DefineRow||[[Typecast]]|}}&lt;br /&gt;
|notes=&lt;br /&gt;
|permission&lt;br /&gt;
|negative_index&lt;br /&gt;
|sort=JsonSetValue&lt;br /&gt;
|cat1=List&lt;br /&gt;
|cat2=String&lt;br /&gt;
|cat3=Data Conversion&lt;br /&gt;
|cat4=JSON&lt;br /&gt;
|history = Date of Release  [[ Release_Notes/Second_Life_Server/13#13.05.20.276191 | 20/05/2013 ]]&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Reconx86 Resident</name></author>
	</entry>
</feed>