tl24 / jsonexserializer

Automatically exported from code.google.com/p/jsonexserializer
1 stars 1 forks source link

Any expression starting with [ is considered a numeric expression #71

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Deserialize("[2]")

What is the expected output? What do you see instead?
List or Array with value 2

What version of the product are you using? On what operating system?
3.1.1.283

Please provide any additional information below.
Any expression starting with [ is considered a numeric expression. The problem 
is solved by providing a space as the first character

Original issue reported on code.google.com by 0Su...@gmail.com on 23 Aug 2013 at 6:49

GoogleCodeExporter commented 9 years ago
I don't understand what the issue is.  Can you give more of a code sample?  
With what type are you constructing the serializer?  The 2 is a numeric 
expression, inside the [] it will be an array.

Original comment by elliott....@gmail.com on 24 Aug 2013 at 2:46

GoogleCodeExporter commented 9 years ago
I feel the framework is treating any string starting with [ and not having a , 
as a numeric expression.  But I may be wrong, please look at the code samples 
below.

Serializer s = new Serializer(typeof(List<int>));
List<int> x = (List<int>)s.Deserialize("[2]"); //gives me a numeric expression 
error
List<int> x = (List<int>)s.Deserialize(" [2]"); //works as expected
Serializer s = new Serializer(typeof(List<String>));
List<String> x = (List<String>)s.Deserialize("[\"2\"]"); //gives me a numeric 
expression error
List<String> x = (List<String>)s.Deserialize(" [\"2\"]"); //works as expected

Somehow a simple fix of adding a " "(space) in front solves the problem.

Original comment by 0Su...@gmail.com on 24 Aug 2013 at 5:27

GoogleCodeExporter commented 9 years ago
I'm unable to reproduce the issue.  It's working fine for me.  Are you in a 
different locale?  What framework and OS is this running on?

Original comment by elliott....@gmail.com on 28 Aug 2013 at 2:26

GoogleCodeExporter commented 9 years ago

Original comment by elliott....@gmail.com on 28 Aug 2013 at 2:27