Commit Graph
98 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
Miguel de Icaza 48992d4b3f Merge pull request #1155 from steffen-kiess/json-string
Fix System.Json string handling and make order of JsonObject entries deterministic
2015-03-06 09:47:56 -05: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
Zoltan Varga c1b4366932 [bcl] Remove NET_4_5 defines from class libs. 2015-01-13 16:34:23 -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
Steffen Kieß 1a021c1e79 Fix handling of strings in System.Json
- Escape control characters, as required by JSON spec
- Escape invalid surrogate pairs
- Escape characters invalid in JavaScript strings
- Escape "</" for HTML script tags
- Fix serialization of chars
- Remove unused variable in JavaScriptReader.cs
- Add tests
2014-07-11 15:46:25 +02:00
Steffen Kieß b005523cb1 Fix several issues in System.Json
- Fix detection of extra characters in JSON input
- Fix detection of invalid negative numeric literals
- Disallow leading zeros
- Use "round-trip" format for floating point numbers
- Serialize NaN and Infinity as strings
- Use NumberFormatInfo.InvariantInfo for Convert.To*()
- Use standard number parsing methods in ReadNumericLiteral()
- Add test cases
2014-07-07 19:22:29 +02:00
Sebastien Pouliot 13ff02dc31 [System.ServiceModel.Web] Fix issue with types explicitly implementing IDictionary or IDictionary<,>
Issue: The previous code, with new tests [1], failed when the linker was
enabled.

That was caused because the code looks for the Keys and Item properties
getter using reflection. The linker handled that imperfectly (it left
some holes), in part because:

* System.Collections.Generic.IDictionary`2 does not implement
  System.Collections.IDictionary; and

* It preserved the explicit methods - not the implicit one that were
  used the the reflection-based code;

That later fact is also a bug (without the linker involvment) and solved
by this commit. A unit test was added to show the issue (NRE).

The patch also avoid the use of reflection for IDictionary since we can
simply typecast to get the same result (without the additional cost).
2014-05-26 17:27:26 -04: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
Atsushi Eno 2d6335f6a7 revert default serialization: ignore non-public members. Also need to exclude backing field in non-default serialization. 2013-08-21 15:44:27 +09:00
Atsushi Eno 8a10b06610 Fix bug #13485: retrieve private fields and properties in serialization. 2013-08-05 15:36:24 +09:00
Martin Baulig efda0d4c62 Revert "Fixes make dist"
This reverts commit 87e95b46ed.

This puts DataContractJsonSerializerSettings.cs back into
mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json.

Let's please not have a single file from this namespace in another
directory, either move the entire System.Runtime.Serialization.Json
stuff into System.Runtime.Serialization or leave it here.
2013-03-15 18:14:44 -04:00
Marek Safar 87e95b46ed Fixes make dist 2013-03-14 17:42:45 +01:00
Martin Baulig 54f7c82d2b DataContractSerializer changes for .NET 4.5.
* Move System.Runtime.Serialization.Json from System.ServiceModel.Web.dll
  into System.Runtime.Serialization.dll on the mobile profile.

* Add DataContractJsonSerializerSettings and DataContractSerializerSettings..
2013-03-12 21:15:56 -04:00
Marek Safar 8063eb0963 Remove broken profile files 2013-02-12 10:19:10 +01:00
Rodrigo Kumpera de71901cf8 Kill the MOONLIGHT define in System.ServiceModel.Web. 2013-02-11 13:01:10 -05:00
Martin Baulig 2ff2fe25fa Support [OnSerializing] in System.Runtime.Serialization.Json.
This fixes a problem that has been reported on stackoverflow:
http://stackoverflow.com/questions/13362906/onserializing-method-not-called-in-mono-3-0-1
2012-11-13 23:04:26 +01:00
Sebastien Pouliot b5573f22de Parse floating point values with negative exponent correctly. Fix bug #4415 2012-04-13 19:19:13 -04:00
Marek Safar 4557955387 Fix JsonReaderWriterFactory parameters names 2012-03-28 11:26:07 +01:00
Marek Safar 2869713c48 Fix some compiler warnings 2012-02-17 12:37:25 +00: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 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