@@ -14,7 +14,7 @@ public class JsonObject : ICloneable
1414 private bool array ;
1515 private int arrayIndex ;
1616 private Dictionary < string , int > di ;
17- private Dictionary < string , float > df ;
17+ private Dictionary < string , decimal > dd ;
1818 private Dictionary < string , string > ds ;
1919 private Dictionary < string , JsonObject > dj ;
2020 private Dictionary < string , bool > db ;
@@ -27,13 +27,13 @@ public JsonObject(bool isArray = false)
2727 this . array = isArray ;
2828 this . arrayIndex = 0 ; // lastInsertedIndex
2929 this . di = new Dictionary < string , int > ( ) ;
30- this . df = new Dictionary < string , float > ( ) ;
30+ this . dd = new Dictionary < string , decimal > ( ) ;
3131 this . ds = new Dictionary < string , string > ( ) ;
3232 this . dj = new Dictionary < string , JsonObject > ( ) ;
3333 this . db = new Dictionary < string , bool > ( ) ;
3434 this . da = new Dictionary < string , JsonObject > ( ) ;
3535 this . dt = new Dictionary < string , JToken > ( ) ;
36- this . types = new string [ 7 ] { "int" , "string" , "JsonObject" , "bool" , "JsonArray" , "float " , "NULL" } ;
36+ this . types = new string [ 7 ] { "int" , "string" , "JsonObject" , "bool" , "JsonArray" , "decimal " , "NULL" } ;
3737 }
3838
3939 public bool isArray ( )
@@ -55,7 +55,7 @@ public void set(int value)
5555 /// Sets/adds the value
5656 /// </summary>
5757 /// <param name="value"></param>
58- public void set ( float value )
58+ public void set ( decimal value )
5959 {
6060 this . set ( this . arrayIndex , value ) ;
6161 this . arrayIndex ++ ;
@@ -138,7 +138,7 @@ public void set(int key, int value)
138138 /// </summary>
139139 /// <param name="key"></param>
140140 /// <param name="value"></param>
141- public void set ( int key , float value )
141+ public void set ( int key , decimal value )
142142 {
143143 this . set ( key . ToString ( ) , value ) ;
144144 }
@@ -208,9 +208,9 @@ public void set(string key, int value)
208208 /// </summary>
209209 /// <param name="key"></param>
210210 /// <param name="value"></param>
211- public void set ( string key , float value )
211+ public void set ( string key , decimal value )
212212 {
213- this . set ( "float " , key , value ) ;
213+ this . set ( "decimal " , key , value ) ;
214214 }
215215
216216 /// <summary>
@@ -268,7 +268,7 @@ public void remove(string key)
268268 {
269269 this . db . Remove ( key ) ;
270270 this . di . Remove ( key ) ;
271- this . df . Remove ( key ) ;
271+ this . dd . Remove ( key ) ;
272272 this . ds . Remove ( key ) ;
273273 this . dj . Remove ( key ) ;
274274 this . da . Remove ( key ) ;
@@ -325,7 +325,7 @@ public void set(string type, string key, Object value)
325325 break ;
326326 case 4 : this . da . Add ( key , ( JsonObject ) value ) ;
327327 break ;
328- case 5 : this . df . Add ( key , ( float ) value ) ;
328+ case 5 : this . dd . Add ( key , ( decimal ) value ) ;
329329 break ;
330330 case 6 : this . dt . Add ( key , ( JToken ) value ) ;
331331 break ;
@@ -453,10 +453,10 @@ public Object get(string key, ref string type)
453453 return this . da [ key ] ;
454454 }
455455
456- if ( this . df . ContainsKey ( key ) )
456+ if ( this . dd . ContainsKey ( key ) )
457457 {
458- type = "float " ;
459- return this . df [ key ] ;
458+ type = "decimal " ;
459+ return this . dd [ key ] ;
460460 }
461461
462462 if ( this . dt . ContainsKey ( key ) )
@@ -530,7 +530,7 @@ public string[] getKeys()
530530 l . Add ( item . Key ) ;
531531 }
532532
533- foreach ( KeyValuePair < string , float > item in this . df )
533+ foreach ( KeyValuePair < string , decimal > item in this . dd )
534534 {
535535 l . Add ( item . Key ) ;
536536 }
@@ -578,7 +578,7 @@ public int count()
578578 count += this . db . Count ;
579579 count += this . dj . Count ;
580580 count += this . da . Count ;
581- count += this . df . Count ;
581+ count += this . dd . Count ;
582582 count += this . dt . Count ;
583583
584584 return count ;
@@ -625,9 +625,9 @@ public string toJson()
625625 {
626626 sb . Append ( this . di [ key ] . ToString ( ) ) ;
627627 }
628- else if ( this . df . ContainsKey ( key ) )
628+ else if ( this . dd . ContainsKey ( key ) )
629629 {
630- sb . Append ( this . df [ key ] . ToString ( "R" , CultureInfo . InvariantCulture ) ) ;
630+ sb . Append ( this . dd [ key ] . ToString ( CultureInfo . InvariantCulture ) ) ;
631631 }
632632 else if ( this . ds . ContainsKey ( key ) )
633633 {
@@ -671,14 +671,14 @@ public string toJson()
671671 index ++ ;
672672 }
673673
674- foreach ( KeyValuePair < string , float > item in this . df )
674+ foreach ( KeyValuePair < string , decimal > item in this . dd )
675675 {
676676 if ( index > 0 )
677677 {
678678 sb . Append ( "," ) ;
679679 }
680680
681- sb . Append ( Json . encode ( item . Key ) + ":" + item . Value . ToString ( "R" , CultureInfo . InvariantCulture ) ) ;
681+ sb . Append ( Json . encode ( item . Key ) + ":" + item . Value . ToString ( CultureInfo . InvariantCulture ) ) ;
682682
683683 index ++ ;
684684 }
0 commit comments