Skip to content

Commit 0b60ded

Browse files
committed
Merge pull request andyburke#21 from crappygraphix/json-parse-long
Added ability to parse long values.
2 parents f17e22e + 41432f0 commit 0b60ded

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

external/JSON.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
/// Spec. details, see http://www.json.org/
1313
///
1414
/// JSON uses Arrays and Objects. These correspond here to the datatypes ArrayList and Hashtable.
15-
/// All numbers are parsed to floats or ints.
15+
/// All numbers are parsed to floats, ints, or longs.
1616
/// </summary>
1717
public class JSON
1818
{
@@ -279,11 +279,17 @@ protected static object ParseNumber (char[] json, ref int index, ref bool succes
279279
success = float.TryParse (token, NumberStyles.Any, CultureInfo.InvariantCulture, out number);
280280
return number;
281281
}
282-
else
282+
else if(token.Length <= 10)
283283
{
284284
int number;
285285
success = int.TryParse(token, out number);
286286
return number;
287+
}
288+
else
289+
{
290+
long number;
291+
success = long.TryParse(token, out number);
292+
return number;
287293
}
288294
}
289295

0 commit comments

Comments
 (0)