donieardianto / google-api-dotnet-client

Automatically exported from code.google.com/p/google-api-dotnet-client
0 stars 0 forks source link

json negative numbers #31

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
this json failed

"utc_offset":-18000

adding
   || cur == '-'

to this case in TokenStream::GetNextToken

default:
            token.type = JsonToken.Type.Undefined;
            if (Char.IsNumber(cur) || cur == '-') {
              sb = new StringBuilder(BuilderBufferSize);
              sb.Append(cur);
              while (IsTokenSeperator((char)reader.Peek()) == false) {
                sb.Append((char)reader.Read());
              }
              token.value = sb.ToString();
              decimal decNumber;
              if(Decimal.TryParse(token.value, out decNumber)){
                token.number = decNumber;
                token.type = JsonToken.Type.Number;
              }
            }
            break;

Fixed it

Original issue reported on code.google.com by daniel.t...@gmail.com on 1 May 2011 at 9:20

GoogleCodeExporter commented 9 years ago

Original comment by davidwat...@google.com on 4 May 2011 at 10:53

GoogleCodeExporter commented 9 years ago
Thanks Daniel,
I have made changes to fix this and a bit more, we where also missing support 
for exponents e.g -1234.567e-3.

This is now in the default branch.

David.

Original comment by davidwat...@google.com on 4 May 2011 at 12:17