<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.docs.clomosy.com/index.php?action=history&amp;feed=atom&amp;title=TclJSONValue</id>
	<title>TclJSONValue - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.docs.clomosy.com/index.php?action=history&amp;feed=atom&amp;title=TclJSONValue"/>
	<link rel="alternate" type="text/html" href="https://www.docs.clomosy.com/index.php?title=TclJSONValue&amp;action=history"/>
	<updated>2026-06-06T06:27:38Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.1</generator>
	<entry>
		<id>https://www.docs.clomosy.com/index.php?title=TclJSONValue&amp;diff=4073&amp;oldid=prev</id>
		<title>Salih: Created page with &quot; The &lt;b&gt;TCLJSONValue&lt;/b&gt; represents the fundamental data element within the TCLJSON library. It serves as a strongly typed container for all supported JSON data types, including &lt;b&gt;string, number, boolean, null, and datetime.&lt;/b&gt;   &lt;div class=&quot;table-responsive&quot; style=&quot;margin-bottom: 20px;&quot;&gt; {| class=&quot;wikitable&quot; style=&quot;border: 2px solid #c3d7e0; width:100%&quot; ! style=&quot;background-color: #c3d7e0&quot;| Feature ! style=&quot;background-color: #c3d7e0&quot;| Use of ! style=&quot;background-color:...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.docs.clomosy.com/index.php?title=TclJSONValue&amp;diff=4073&amp;oldid=prev"/>
		<updated>2025-10-22T14:40:38Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot; The &amp;lt;b&amp;gt;TCLJSONValue&amp;lt;/b&amp;gt; represents the fundamental data element within the TCLJSON library. It serves as a strongly typed container for all supported JSON data types, including &amp;lt;b&amp;gt;string, number, boolean, null, and datetime.&amp;lt;/b&amp;gt;   &amp;lt;div class=&amp;quot;table-responsive&amp;quot; style=&amp;quot;margin-bottom: 20px;&amp;quot;&amp;gt; {| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;border: 2px solid #c3d7e0; width:100%&amp;quot; ! style=&amp;quot;background-color: #c3d7e0&amp;quot;| Feature ! style=&amp;quot;background-color: #c3d7e0&amp;quot;| Use of ! style=&amp;quot;background-color:...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
The &amp;lt;b&amp;gt;TCLJSONValue&amp;lt;/b&amp;gt; represents the fundamental data element within the TCLJSON library.&lt;br /&gt;
It serves as a strongly typed container for all supported JSON data types, including &amp;lt;b&amp;gt;string, number, boolean, null, and datetime.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;table-responsive&amp;quot; style=&amp;quot;margin-bottom: 20px;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;border: 2px solid #c3d7e0; width:100%&amp;quot;&lt;br /&gt;
! style=&amp;quot;background-color: #c3d7e0&amp;quot;| Feature&lt;br /&gt;
! style=&amp;quot;background-color: #c3d7e0&amp;quot;| Use of&lt;br /&gt;
! style=&amp;quot;background-color: #c3d7e0&amp;quot;| Definition&lt;br /&gt;
|-&lt;br /&gt;
| '''Create(AValue: TJSONValue)''' || val = TCLJSONValue.Create(SomeJSONValue); || Initializes a TCLJSONValue instance by wrapping an existing TJSONValue reference.&lt;br /&gt;
|-&lt;br /&gt;
| '''AsString''' || text = val.AsString; || Returns the stored value as a string if its type is string-compatible.&lt;br /&gt;
|-&lt;br /&gt;
| '''AsInteger''' || num = val.AsInteger; || Converts and retrieves the value as an integer type.&lt;br /&gt;
|-&lt;br /&gt;
| '''AsFloat''' || fnum = val.AsFloat; || Retrieves the numeric value as a floating-point number.&lt;br /&gt;
|-&lt;br /&gt;
| '''AsBoolean''' || flag = val.AsBoolean; || Returns the stored value as a boolean (True or False).&lt;br /&gt;
|-&lt;br /&gt;
| '''AsDateTime''' || dt = val.AsDateTime; || Retrieves the stored value as a TDateTime object if it represents a date/time.&lt;br /&gt;
|-&lt;br /&gt;
| '''IsNull''' || val.IsNull || Checks whether the current value is null.&lt;br /&gt;
|-&lt;br /&gt;
| '''IsString''' || val.IsString || Returns True if the value is a string type.&lt;br /&gt;
|-&lt;br /&gt;
| '''IsNumber''' ||val.IsNumber|| Returns True if the value is numeric (integer or float).&lt;br /&gt;
|-&lt;br /&gt;
| '''IsBoolean''' || val.IsBoolean  || Returns True if the value represents a boolean type.&lt;br /&gt;
|-&lt;br /&gt;
| '''IsDateTime''' || val.IsDateTime || Returns True if the stored value is a date/time type.&lt;br /&gt;
|-&lt;br /&gt;
| '''ToString''' || jsonText = val.ToString; || Converts the internal value to its JSON-compatible string representation.&lt;br /&gt;
|-&lt;br /&gt;
| '''GetValueByPath''' || childVal = val.GetValueByPath('data.user.name'); || Retrieves a nested JSON value using dot notation within a hierarchical structure.&lt;br /&gt;
|-&lt;br /&gt;
| '''Str''' || val = TCLJSONValue.Str('Hello'); || Creates a TCLJSONValue instance representing a string type.&lt;br /&gt;
|-&lt;br /&gt;
| '''Num''' || val = TCLJSONValue.Num(25.75); || Creates a TCLJSONValue instance containing a floating-point number.&lt;br /&gt;
|-&lt;br /&gt;
| '''Int''' || val = TCLJSONValue.Int(100); || Creates a TCLJSONValue instance representing an integer number.&lt;br /&gt;
|-&lt;br /&gt;
| '''Bool''' || val = TCLJSONValue.Bool(True); || Creates a TCLJSONValue instance representing a boolean value.&lt;br /&gt;
|-&lt;br /&gt;
| '''DT''' || val = TCLJSONValue.DT(Now); || Creates a TCLJSONValue instance containing a TDateTime value.&lt;br /&gt;
|-&lt;br /&gt;
| '''Null''' || val = TCLJSONValue.Null; || Creates a TCLJSONValue instance representing a null JSON value.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;margin-bottom: 20px;&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;infobox&amp;quot; style=&amp;quot;width: 100%; border: 1px solid #28a745; background-color: #d4edda; border-radius: 5px; padding: 15px; border-collapse: separate;&amp;quot;&lt;br /&gt;
| style=&amp;quot;font-weight: bold; color: #28a745; padding-bottom: 5px;&amp;quot; | Important: Data Type&lt;br /&gt;
|-&lt;br /&gt;
| Avoid mixing data types when reading or writing JSON values; each accessor ('''AsString''', '''AsFloat''') must correspond to the original type.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Example: TCLJSONValue in Use ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  MyForm: TClForm;&lt;br /&gt;
  InputEdt: TClProEdit;&lt;br /&gt;
  StrBtn, NumBtn, BoolBtn, CheckBtn, ClearBtn: TClProButton;&lt;br /&gt;
  OutputMemo: TClMemo;&lt;br /&gt;
  JVal: TCLJSONValue;&lt;br /&gt;
&lt;br /&gt;
void CreateStringValue&lt;br /&gt;
{&lt;br /&gt;
  JVal = TCLJSONValue.Str(InputEdt.Text);&lt;br /&gt;
  OutputMemo.Lines.Text = 'String Value: ' + JVal.AsString;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void CreateNumberValue&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
  JVal = TCLJSONValue.Num(StrToFloat(InputEdt.Text));&lt;br /&gt;
  OutputMemo.Lines.Text = 'Number Value: ' + FloatToStr(JVal.AsFloat);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void CreateBooleanValue&lt;br /&gt;
var&lt;br /&gt;
  inputLower: string;&lt;br /&gt;
{&lt;br /&gt;
  inputLower = LowerCase(Trim(InputEdt.Text));&lt;br /&gt;
  if ((inputLower == 'true') || (inputLower == '1') || (inputLower == 'yes'))&lt;br /&gt;
    JVal = TCLJSONValue.Bool(True)&lt;br /&gt;
  else&lt;br /&gt;
    JVal = TCLJSONValue.Bool(False);&lt;br /&gt;
&lt;br /&gt;
  if (JVal.AsBoolean)&lt;br /&gt;
    OutputMemo.Lines.Text = 'Boolean Value: True'&lt;br /&gt;
  else&lt;br /&gt;
    OutputMemo.Lines.Text = 'Boolean Value: False';&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void CheckValueType&lt;br /&gt;
var&lt;br /&gt;
  info: string;&lt;br /&gt;
{&lt;br /&gt;
  if (JVal.IsNull)&lt;br /&gt;
    info = 'Type: Null'&lt;br /&gt;
  else if (JVal.IsNumber)&lt;br /&gt;
    info = 'Type: Number'&lt;br /&gt;
  else if (JVal.IsString)&lt;br /&gt;
    info = 'Type: String'&lt;br /&gt;
  else if (JVal.IsBoolean)&lt;br /&gt;
    info = 'Type: Boolean'&lt;br /&gt;
  else if (JVal.IsDateTime)&lt;br /&gt;
    info = 'Type: DateTime'&lt;br /&gt;
  else&lt;br /&gt;
    info = 'Unknown type';&lt;br /&gt;
&lt;br /&gt;
  ShowMessage(info);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void ClearValue&lt;br /&gt;
{&lt;br /&gt;
  JVal = TCLJSONValue.Null;&lt;br /&gt;
  OutputMemo.Lines.Text = 'Value cleared (Null)';&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
  MyForm = TClForm.Create(Self);&lt;br /&gt;
&lt;br /&gt;
  InputEdt = MyForm.AddNewProEdit(MyForm, 'InputEdt', 'Enter a value...');&lt;br /&gt;
  InputEdt.Align = alTop;&lt;br /&gt;
  InputEdt.Height = 35;&lt;br /&gt;
  InputEdt.Margins.Left = 10;&lt;br /&gt;
  InputEdt.Margins.Right = 10;&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
  OutputMemo = MyForm.AddNewMemo(MyForm, 'OutputMemo', 'Output');&lt;br /&gt;
  OutputMemo.Align = alClient;&lt;br /&gt;
  OutputMemo.Height = 150;&lt;br /&gt;
  OutputMemo.Margins.Left = 10;&lt;br /&gt;
  OutputMemo.Margins.Right = 10;&lt;br /&gt;
  OutputMemo.TextSettings.WordWrap = True;&lt;br /&gt;
&lt;br /&gt;
  StrBtn = MyForm.AddNewProButton(MyForm, 'StrBtn', 'Create String Value');&lt;br /&gt;
  StrBtn.Align = alBottom;&lt;br /&gt;
  StrBtn.OnClick = 'CreateStringValue';&lt;br /&gt;
&lt;br /&gt;
  NumBtn = MyForm.AddNewProButton(MyForm, 'NumBtn', 'Create Number Value');&lt;br /&gt;
  NumBtn.Align = alBottom;&lt;br /&gt;
  NumBtn.OnClick = 'CreateNumberValue';&lt;br /&gt;
&lt;br /&gt;
  BoolBtn = MyForm.AddNewProButton(MyForm, 'BoolBtn', 'Create Boolean Value');&lt;br /&gt;
  BoolBtn.Align = alBottom;&lt;br /&gt;
  BoolBtn.OnClick = 'CreateBooleanValue';&lt;br /&gt;
&lt;br /&gt;
  CheckBtn = MyForm.AddNewProButton(MyForm, 'CheckBtn', 'Check Value Type');&lt;br /&gt;
  CheckBtn.Align = alBottom;&lt;br /&gt;
  CheckBtn.OnClick = 'CheckValueType';&lt;br /&gt;
&lt;br /&gt;
  ClearBtn = MyForm.AddNewProButton(MyForm, 'ClearBtn', 'Clear Value');&lt;br /&gt;
  ClearBtn.Align = alBottom;&lt;br /&gt;
  ClearBtn.OnClick = 'ClearValue';&lt;br /&gt;
&lt;br /&gt;
  MyForm.Run;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:TclJSONValue.png|frameless|600px]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt; See Also &amp;lt;/h2&amp;gt;&lt;br /&gt;
* [[TclJSONArray]]&lt;br /&gt;
* [[TclJSONObject]]&lt;br /&gt;
* [[TclJSONPair]]&lt;br /&gt;
* [[TclJSON]]&lt;br /&gt;
&lt;br /&gt;
{{#seo:|title=TCLJSONValue Class - Clomosy Docs}}&lt;br /&gt;
{{#seo:|description=Detailed documentation of TCLJSONValue class, including features, methods, Types, and practical examples for JSON Value control.}}&lt;/div&gt;</summary>
		<author><name>Salih</name></author>
	</entry>
</feed>