Commit Graph
73 Commits
Author SHA1 Message Date
Jonathan Pryor e35e45293b [System.ServiceModel.Web] Support null as value for DateTime? field.
Fixes assistly #5863.
2012-01-04 16:35:02 -05:00
Miguel de Icaza 37b85d86ac Allow trailing commas on Json objects 2011-12-29 09:10:26 -05:00
Miguel de Icaza 88e2387665 Extend JsonSerializerReader to support nullables and parse a wider range of Date formats, fixes x#163 2011-11-24 01:29:27 -05:00
Andreia Gaita d8dc259299 [json] revert part of 382a385a8f, it regresses moon drt 983 2011-05-03 21:54:42 +01:00
Atsushi Eno 52da339835 Looks like .NET accepts non-integer numbers as int. Smells bogus though. 2011-04-06 22:02:58 +09:00
Atsushi Eno 01671273bb Fix build, looks like ArrayList is internally available in moon. 2011-04-05 23:05:43 +09:00
Atsushi Eno 382a385a8f Collection support in JSON serializer was actually for any IEnumerable. 2011-04-05 20:55:32 +09:00
Atsushi Eno 696ff71de2 Revert PushbackReader changes (was unnecessary and actually bogus). 2011-04-05 20:26:09 +09:00
Atsushi Eno 7a32f7a4a1 null value also outputs "type='null' in WCF JSON writer. 2011-04-05 19:47:54 +09:00
Atsushi Eno 5670f5b5ce Auto-detect text encoding from input stream for JsonReader. Fix DBCS pushback. 2011-04-05 18:22:56 +09:00
Atsushi Eno 3f0fe0dcde IDictionary`2 serialization support was missing in DataContractJsonSerializer.
Fixed bug #685042.
2011-04-05 13:19:54 +09:00
Sebastien Pouliot fc47bc9340 AppDomain.GetAssemblies() is available (it's internals) in Moonlight
* JsonSerializationReader.cs: Remove #if wrt MOONLIGHT since the API
is available (internal but Moonlight's mscorlib has an IVT on S.SM)
2011-04-04 08:24:25 -04:00
Atsushi Eno 60300f821d A bit less !NET_2_1 and !MOONLIGHT in Sys.ServiceModel.Web. 2011-04-02 04:10:09 +09:00
Atsushi Eno 7917753273 null JSON type must be handled in JsonWriter. 2011-03-26 21:27:19 +09:00
Atsushi Eno ea7e0d189a Do not always assume ascii == 1 byte in JsonWriter. Fix utf-16 usage. 2011-03-26 21:00:16 +09:00
Miguel de Icaza 4a7c594eb1 [System.Json] Fix loader.
The current loader failed with some Json strings due to the implementation
of the BufferedStreamReader.   Removed that implementation completely,
and instead depend on the StreamReader to do the actual BOM detection.

This removes the JavaScriptObjectDeserializer.cs file
2011-03-08 17:54:28 -05:00
Geoff Norton 7f2d20a0a8 Work around a full-aot issue for monotouch System.Json 2011-01-25 01:50:57 -05:00
Atsushi Eno 7a0f8f89a0 Fix bogus encoding detection in JavaScriptObjectDeserializer. 2011-01-21 12:09:42 +09:00
Andreia Gaita 5f78cb8870 [JsonWriter] Fix JsonWriter yet again. Behaviour of WriteRaw on .net and sl is
different, so ifdef to make everyone happy!
2010-10-29 16:03:57 +01:00
Atsushi Eno 5a406fd3a3 Fix JsonWriterTest.WriteRaw() regression. WriteRaw() is (looking) almost identical to WriteString() here. 2010-10-29 13:30:35 +09:00
Andreia Gaita 987ef9dbab [Json] Add support for calling external json (de)serialization methods
On Moonlight, ScriptObject types have custom (de)serialization methods that
need to be called whenever a user object includes properties of that type.
This patch creates a TypeMap subclass (ExternalTypeMap) and exposes a method
that can be called from moon's System.Windows.Browser to register custom
serialization and deserialization methods, keyed by type. These are called
whenever a property is found with a type (or base type) that has custom
methods registered.
2010-10-16 19:58:08 +01:00
Andreia Gaita ef2049a2b6 [Json] Fix decimal type serialization 2010-10-16 19:58:08 +01:00
Andreia Gaita 7cfce53c32 [Json] Fix uint type conversion when reading, should be mapped to long, not int 2010-09-30 21:03:12 +01:00
Rolf Bjarne Kvinge f7a0fde4c6 JsonSerializationWriter: handle char values 2010-09-24 12:11:36 +02:00
Andreia Gaita 778694e1b8 Add support for deserializing Char types
* JsonSerializationReader.cs: Add Char type to the switch. Reads the
  content as a string and validates its length
2010-07-27 20:12:02 +01:00
Andreia Gaita 4a6ea9c095 Add serialization support for generic IDictionary objects
* JsonSerializationReader.cs, JsonSerializationWriter.cs:
  Add a special case for IDictionary, since KeyValuePair objects
  have private setters and can't be processed via the normal
  object code path.
2010-07-27 20:08:15 +01:00
Atsushi Eno 3e59168e9d 2010-07-06 Atsushi Enomoto <[email protected]>
* TypeMap.cs :
	  Do not try to add static members as serialization targets.
	  Support OnDeserializing and OnDeserialized. Fixed bug #615800.

	* DataContractJsonSerializerTest.cs : add test for bug #615800.


svn path=/trunk/mcs/; revision=159958
2010-07-06 13:41:08 +00:00
Atsushi Eno b79dda6c6d 2010-07-06 Atsushi Enomoto <[email protected]>
* JsonSerializationWriter.cs : it cannot serialize DateTime in
	  double, which causes crash in deserializer.


svn path=/trunk/mcs/; revision=159945
2010-07-06 09:21:34 +00:00
Atsushi Eno 6ce2b49f94 2010-07-06 Atsushi Enomoto <[email protected]>
* TypeMap.cs : when an object is null, return null, not just an 
	  uninitialized object.

	* DataContractJsonSerializerTest.cs : add test for bug #615801.


svn path=/trunk/mcs/; revision=159944
2010-07-06 09:08:57 +00:00
Atsushi Eno 4efe543e9f 2010-07-06 Atsushi Enomoto <[email protected]>
* DataContractJsonSerializer_2_1.cs : add extra methods for
	  Sys.SM.Web.Extensions build.

	* WebMessageFormatter.cs : add NET_2_1 profile build.

	* AssemblyInfo.cs : InternalVisibleTo System.ServiceModel.Web.Extensions.


svn path=/trunk/mcs/; revision=159943
2010-07-06 08:59:28 +00:00
Atsushi Eno 13e5341363 2010-07-06 Atsushi Enomoto <[email protected]>
* JsonReader.cs : do not keep Attribute state once Read() is called.


svn path=/trunk/mcs/; revision=159942
2010-07-06 08:53:58 +00:00
Atsushi Eno 02c1565c69 2010-04-24 Atsushi Enomoto <[email protected]>
* JsonSerializationReader.cs : use List<T> if the contract
          member type is interface.


svn path=/trunk/mcs/; revision=156039
2010-04-24 07:11:05 +00:00
Jb Evain e1dc31d7ab use MOONLIGHT symbol
svn path=/trunk/mcs/; revision=153653
2010-03-16 10:53:59 +00:00
Kornél Pál 85ceae01fd JavaScriptReader.cs: Deserialize false correctly. Fixed bug #586712.
svn path=/trunk/mcs/; revision=153536
2010-03-13 09:48:25 +00:00
Atsushi Eno 6f0cd4a650 2010-03-10 Atsushi Enomoto <[email protected]>
in System.ServiceModel.Web:
	* JavaScriptReader.cs : moved from Sys.Json/JsonReader.cs.

	* net_2_0_System.ServiceModel.Web.dll.sources,
	  net_2_1_raw_System.ServiceModel.Web.dll.sources :
	  move JsonReader.cs as Sys.R.S.Json/JavaScriptReader.cs

in System.Json:
	* JsonReader.cs : moved to Sys.SM.Web/Sys.R.S.Json.

	* System.Json.dll.sources : remove JsonReader.cs.


svn path=/trunk/mcs/; revision=153393
2010-03-10 10:22:36 +00:00
Atsushi Eno 286c255027 2010-03-10 Atsushi Enomoto <[email protected]>
in System.ServiceModel.Web:
	* JavaScriptObjectDeserializer.cs : new internal file, which is
	  used by System.Json (for moonlight compatibility).

	* net_2_0_System.ServiceModel.Web.dll.sources,
	  net_2_1_raw_System.ServiceModel.Web.dll.sources :
	  add JavaScriptObjectDeserializer.cs and JsonReader in Sys.Json
	  (which is to be moved later).

	* AssemblyInfo.cs: added InternalVisibleTo(System.Json). Also added
	  dummy 2.0 for easy testing.

in System.Json:

	* JsonValue.cs : use Sys.SM.Web.dll's JavaScriptObjectDeserializer
	  for silverlight sdk / moonlight compatibility.
	* JsonReader.cs : renamed to JavaScriptReader (for disambiguation in
	  Sys.SM.Web.dll). Now it is native-type based and used by the above
	  deserializer.

	* Makefile : reference System.Xml and System.ServiceModel.Web (for
	  moonlight compatibility).

	* AssemblyInfo.cs : use the same pub key in 2.0 (dummy), to ease
	  testing locally.



svn path=/trunk/mcs/; revision=153392
2010-03-10 10:17:24 +00:00
Atsushi Eno 2e11b2e4fa 2010-03-09 Atsushi Enomoto <[email protected]>
* JsonSerializationWriter.cs, JsonSerializationReader.cs,
	  JsonWriter.cs : Fix DateTime serialization and "\/" string escape
	  issues. Fixed bug #586169.

	* DataContractJsonSerializerTest.cs : add test for bug #586169.
	* JsonWriterTest.cs : add standalone write case for "\/".


svn path=/trunk/mcs/; revision=153318
2010-03-09 11:21:24 +00:00
Atsushi Eno a7b1a7ee44 2010-02-24 Atsushi Enomoto <[email protected]>
* JsonWriter.cs : write NaN, INF, -INF as JSON string, not JSON number.
	  Fixed bug #573691.


svn path=/trunk/mcs/; revision=152342
2010-02-24 09:46:11 +00:00
Atsushi Eno 9579012ec5 2010-01-27 Atsushi Enomoto <[email protected]>
* DataContractJsonSerializer.cs : KnownTypes does not include root
	  type. Fixed bug #573689.

	* DataContractJsonSerializerTest.cs :
	  enable TypeIsNotPartsOfKnownTypes(), and add more related tests.


svn path=/trunk/mcs/; revision=150279
2010-01-27 06:17:48 +00:00
Atsushi Eno 1c2432b083 2010-01-27 Atsushi Enomoto <[email protected]>
* JsonSerializationReader.cs : oops, wrong fix, should consume the
	  reader.


svn path=/trunk/mcs/; revision=150277
2010-01-27 05:42:33 +00:00
Atsushi Eno 6cd5a57fc3 2010-01-27 Atsushi Enomoto <[email protected]>
* JsonSerializationReader.cs : "null" for string should be read as
	  null, not String.Empty. Fixed bug #573690.

	* DataContractJsonSerializerTest.cs : null-string case is working.


svn path=/trunk/mcs/; revision=150276
2010-01-27 05:36:54 +00:00
Sebastien Pouliot 0f34c4b534 2010-01-26 Sebastien Pouliot <[email protected]>
* DataContractJsonSerializer_2_1.cs: Don't hide [Field|Method]
	AccessException inside a SerializationException but in a 
	SecurityException.


svn path=/trunk/mcs/; revision=150219
2010-01-26 18:32:30 +00:00
Sebastien Pouliot 21bda63388 2010-01-25 Sebastien Pouliot <[email protected]>
* DataContractJsonSerializer_2_1.cs: New. Simpler version for 
	Moonlight since it does not inherit from the same base type nor
	does it overrides any base methods.


svn path=/trunk/mcs/; revision=150149
2010-01-25 20:58:11 +00:00
Atsushi Eno f30add0fba 2010-01-08 Atsushi Enomoto <[email protected]>
* TypeMap.cs : forward port r145077 (see change line for 2009-10-29).


svn path=/trunk/mcs/; revision=149212
2010-01-08 04:28:58 +00:00
Atsushi Eno 0ede800ea0 2009-12-14 Atsushi Enomoto <[email protected]>
* TypeMap.cs : handle [Serializable] objects such as KeyValuePair<,>
	  like we do in 2.0. Removed previous workarounds. (Do not serialize
	  and deserialize nonpublic members in "default" mappings.)


svn path=/trunk/mcs/; revision=148364
2009-12-14 03:36:28 +00:00
Chris Toshok f231a6cb9b in System.Runtime.Serialization.Json:
2009-12-11  Chris Toshok  <[email protected]>

	* TypeMap.cs (CreateDefaultTypeMap): only include non-public
	property info when dealing with KeyValuePair<,>.  This is *not*
	the way MS handles it, but we emulate things much better with this
	hack.

in test/System.Runtime.Serialization.Json/:
2009-12-11  Chris Toshok  <[email protected]>

	* DataContractJsonSerializerTest.cs: add a test case for
	non-public properties.


svn path=/trunk/mcs/; revision=148184
2009-12-12 00:14:23 +00:00
Atsushi Eno 6557535276 2009-12-11 Atsushi Enomoto <[email protected]>
* JsonReader.cs : e- and e+ was resulting in wrong parse error.
	  This should fix part of bug #531904.

	* JsonReaderTest.cs : another number parse case.


svn path=/trunk/mcs/; revision=148099
2009-12-11 12:54:10 +00:00
Chris Toshok 4e5653512f 2009-12-08 Chris Toshok <[email protected]>
* JsonSerializationReader.cs (DeserializeGenericCollection): in
	the 2.1 case we still need to convert the List<> to an array.

svn path=/trunk/mcs/; revision=147835
2009-12-08 08:05:31 +00:00
Chris Toshok 7297458838 in System.ServiceModel.Web/System.Runtime.Serialization.Json:
2009-12-07  Chris Toshok  <[email protected]>

	* JsonReaderWriterFactory.cs (CreateJsonReader): pass null for the
	encoding parameter instead of calling Detect.  The jsonreader's
	PushbackReader will autodetect.
	(Detect): remove.  a BufferedStream created from an unseekable
	stream is itself unseekable, which makes it just as useless.  This
	breaks netflix's isostore file parsing.

	* JsonReader.cs (PushbackReader): add a ctor which doesn't take an
	encoding, for the autodetecting reader case.  for this ctor, pass
	true to StreamReader's ctor for detectEncodingFromByteOrderMarks.

svn path=/trunk/mcs/; revision=147829
2009-12-08 04:56:29 +00:00
Chris Toshok 8718686805 in class/corlib/System.Collections.Generic/:
2009-12-06  Chris Toshok  <[email protected]>

	* KeyValuePair.cs: we need setters for Key and Value so they can
	be set via reflection from
	System.ServiceModel.System.Runtime.Serialization.Json.TypeMap.cs.

in class/System.ServiceModel.Web/System.Runtime.Serialization.Json/:
2009-12-06  Chris Toshok  <[email protected]>

	* JsonSerializationReader.cs (DeserializeGenericCollection): this
	is jb's (iirc) patch, actually.  Types subclassing from
	ICollection<T> need to be supported, and since it's an interface
	the implementation might be explicit.  So instead of groveling
	around in the actual type, we need to dispatch through the
	interface's method.

	* TypeMap.cs (CreateDefaultTypeMap): we need to include non-public
	properties, since KeyValuePair items must be able to write to Key
	and Value properties.

	* JsonReader.cs (ReadContent): for builtin values (null, true,
	false), use TryReadString instead of individual ReadChar's, since
	they aren't reversible if the string didn't match.  In the default
	case, if we're LameSilverlightLiseralParser, we need to push back
	the current character onto the stream -- this is because for
	netflix's AppConfig.json we were parsing "frameRatePolicy" as
	"rameRatePolicy" (the 'f' was triggering the "false" parsing).
	(class PushBackReader): add this class to unify all the pushing
	back of characters we need to do.  1 character (JsonReader's old
	"saved_char") isn't enough given that you could have a property
	named, e.g., "falsifiable", and we'd need 4 characters worth of
	pushback to recognize that correctly.

svn path=/trunk/mcs/; revision=147766
2009-12-07 07:39:17 +00:00