Commit Graph
32 Commits
Author SHA1 Message Date
Alexis Christoforides 22d5581e87 [DataContractJsonSerializer] Allow abstract base classes in lists. Fixes #26998
Abstract classes can still have subclasses with KnownType attributes, which are allowed in deserialization.

This used to work as the '__type' hint  was always honored no matter the type, and broke with https://github.com/mono/mono/commit/71e152accc727089faffa6b4fd6bf58cb62636cf which removed that behavior.
2015-03-09 01:23:27 -04:00
Zoltan Varga ba6d6d74cd [bcl] Fix the serialization of string arrays to IEnumerable<string> in the Json serializer. Fixes #25808. 2015-01-16 14:11:51 -05:00
Alexis Christoforides e92af12248 Fix oops in DataContractJsonSerializer fix 2014-10-08 22:04:34 -07:00
Alexis Christoforides 71e152accc [bcl] Implement KnownTypes for DataContractJsonSerializer. Fixes #23058 and polymorphism support.
Also discarded old __type hint behavior in JsonSerializationReader that potentially allowed any loaded type to be instantiated.
2014-10-07 16:24:41 -07:00
Marcos Henrich 92a4fd26ac Improved Json deserialization of floating-point numbers.
When DataContractJsonSerializer was created from type object, deserialization of floating.point numbers was not possible.
Fixes 21583.
2014-09-25 15:30:46 +01:00
Antoine Cailliau b2b269b1e8 [Fix] DataContractJsonSerializer fails serializing/deserializing collections 2014-04-16 15:10:17 +02:00
Sebastien Pouliot 56d406876f [System.ServiceModel.Web] Fix regression when converting strings using some (like German) cultures [#18131] and add unit test 2014-03-04 09:00:36 -05:00
Atsushi Eno 21cb4135ea fix bug #16744 - null values on nullable value types were not handled in deserializer. 2014-02-06 17:11:30 +09:00
Jonathan Pryor eda41be355 Support deserializing relative Uris. Fixes #15169.
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=15169
2013-10-03 11:06:21 -04:00
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 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 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
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
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 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
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 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
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 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
Atsushi Eno 340cc5ba4d 2009-11-12 Atsushi Enomoto <[email protected]>
*  JsonSerializationReader.cs : reuse generic collection search
	  logic in KnownTypeCollection.cs. Fixed bug #551671.


svn path=/trunk/mcs/; revision=146023
2009-11-12 08:15:40 +00:00
Atsushi Eno b5688b9e2d add experimental monotouch build.
svn path=/trunk/mcs/; revision=144701
2009-10-23 02:37:20 +00:00
Atsushi Eno 42e9eccb49 2009-09-22 Atsushi Enomoto <[email protected]>
* JsonSerializationWriter.cs : output "type" attribute on bool
	  values too.
	* JsonSerializationReader.cs : type loading attempt was insufficient
	  and hence often missed indicated types to deserialize.


svn path=/trunk/mcs/; revision=142423
2009-09-22 17:30:32 +00:00
Andreia Gaita 523919603d 2009-02-02 Andreia Gaita <[email protected]>
* JsonSerializationReader.cs : Use 2.1 "approved" calls for Enum.Parse
    and Convert.ChangeType

svn path=/trunk/mcs/; revision=125298
2009-02-02 02:52:45 +00:00
Jb Evain 982e3b35a4 move to from olive to mcs
svn path=/trunk/mcs/; revision=111188
2008-08-20 21:25:05 +00:00