Commit Graph
52 Commits
Author SHA1 Message Date
Miguel de Icaza 311684d140 When serializing floats and doubles, use the InvariantCulture, so that floats are always stored in Json format, not the locale-specific format; As reported on irc 2013-02-28 23:09:50 -05:00
Marek Habersack 7b1d9f179c Removed original license since no substantial portions of the original software are used in our implementation 2012-11-08 13:42:48 +01:00
Atsushi Eno e10c36924b Fix JavaScriptSerializer.Deserialize() for dictionary of array of anonymously typed dictionary.
context: https://twitter.com/muo_jp/status/265373491224801280
2012-11-05 18:22:29 +09:00
Marek Safar 15af51806d Merge pull request #214 from QuickJack/cd2c570c5543963d987f51080218715407c5d4b9
Fixes 2 problems in Mono's configuration stack.
2012-01-11 11:27:25 -08:00
Marek Safar 42cdbf3f8f Make System.Web.Script.Serialization.JavaScriptSerializer.ConvertToType(Type, object) public. Fixes #2781 2012-01-09 21:46:52 +00:00
QuickJack d0b2d82e13 Fixes some warnings in System.Web.Extensions.dll 2011-12-29 15:59:41 +01:00
Marek Habersack 63750449f5 [asp.net] Fix for bug #655474. Don't assume an Uri being serialized is an absolute one 2011-03-17 16:15:23 +01:00
Marek Habersack b68b65ad17 2009-08-18 Marek Habersack <[email protected]>
* Makefile (TEST_RESOURCE_FILES): added
	Test/mainsoft/NunitWebResources/DuplicateControlsInClientComment.aspx

2009-08-18  Marek Habersack  <[email protected]>

	* ControlBuilder.cs: Location property makes a copy of assigned
	ILocation now.

2009-08-18  Marek Habersack  <[email protected]>

	* AspParser.cs: added a constructor which creates an internal
	parser, nested within the outer one, and adjusts its ILocation
	members to report correct locations in the outer parser for better
	error reporting. Inner parser also returns the outer's FileText,
	if available.

	* AspGenerator.cs: restored part of r138474 reverted in r138657,
	r138658 and r138659 to fix bug #525104
	BuilderLocation creates a copy of Location for its own use (since
	the ILocation passed is actually AspParser, the line numbers
	change between creating a BuilderLocation and using its Location
	member).
	The end of tag, expression and client comment regular expressions
	now use lazy quantifiers. This fixes bugs #525104 and #517656
	Client side comment blocks aren't ignored anymore, they are parsed
	just as the other parts of the document. Fixes bug #524358

2009-08-18  Marek Habersack  <[email protected]>

	* JavaScriptSerializer.cs: read converters from the config only if
	explicitly requested.

2009-08-18  Marek Habersack  <[email protected]>

	* TemplateControlCompilerTest.cs: added test for bug #525104 and
	improved test for bug #517656

svn path=/trunk/mcs/; revision=140161
2009-08-18 13:31:49 +00:00
Marek Habersack 83dfe82864 2009-08-17 Marek Habersack <[email protected]>
* ScriptingJsonSerializationSection.cs: MaxJsonLength default
	value is 2097152 for .NET 3.5+

2009-08-17  Marek Habersack  <[email protected]>

	* JsonSerializer.cs: serialize fields before properties.

	* JavaScriptSerializer.cs: MaxJsonLength default value for .NET
	3.5 is 2097152

2009-08-17  Marek Habersack  <[email protected]>

	* JavaScriptSerializerTest.cs: fixed broken tests

svn path=/trunk/mcs/; revision=140098
2009-08-17 20:43:45 +00:00
Marek Habersack 1a9392fea7 2009-08-15 Marek Habersack <[email protected]>
* LogicalTypeInfo.cs: make sure JavaScriptSerializer instance used
	here reads custom converters from web.config. Fixes bug #525589

svn path=/trunk/mcs/; revision=140004
2009-08-15 02:23:55 +00:00
Marek Habersack 9ccd39fb07 2009-03-17 Marek Habersack <[email protected]>
* JavaScriptSerializer.cs: if conversion of IDictionary or
	IDictionary <K,V> to an object is requested, make sure that a
	concrete type is used (in both cases Dictionary <string, object>).
	Make sure that if the target type is an IDictionary<K,V> that the
	key is either an object or a string.

2009-03-17  Marek Habersack  <[email protected]>

	* JavaScriptSerializerTest.cs: added tests for conversion to
	IDictionary and IDictionary <K,V> types.

svn path=/trunk/mcs/; revision=129580
2009-03-17 13:21:57 +00:00
Marek Habersack 1dfc535d36 2009-03-06 Marek Habersack <[email protected]>
* JsonDeserializer.cs: unquoted key values must ignore leading
	and trailing whitespace

2009-03-06  Marek Habersack  <[email protected]>

	* JavaScriptSerializerTest.cs: added a test for unquoted tests
	surrounded with spaces.

svn path=/trunk/mcs/; revision=128801
2009-03-06 22:16:37 +00:00
Marek Habersack 51f5087bf2 2008-12-05 Marek Habersack <[email protected]>
* JsonSerializer.cs: StringBuilder extension methods aren't used
	anymore, changed to calls to static methods in
	StringBuilderExtensions.

	* StringBuilderExtensions.cs: cannot use extension methods here
	because this file is also used in the version 1.0 build which
	doesn't reference System.Core

svn path=/trunk/mcs/; revision=120823
2008-12-05 11:43:42 +00:00
Marek Habersack 4168d10fa1 Cleanup
svn path=/trunk/mcs/; revision=116714
2008-10-22 00:49:55 +00:00
Marek Habersack 0b087aff65 2008-10-22 Marek Habersack <[email protected]>
* JsonDeserializer.cs: object can contain more than one unquoted
	keys.

2008-10-22  Marek Habersack  <[email protected]>

	* JavaScriptSerializerTest.cs: added tests for deserialization of
	objects with more than one unquoted key names.

svn path=/trunk/mcs/; revision=116713
2008-10-22 00:46:42 +00:00
Marek Habersack 1905082013 2008-09-23 Marek Habersack <[email protected]>
* LogicalTypeInfo.cs: do not use
	LazyDictionary as enum serializer anymore.

	* ProfileService.cs: do not use
	LazyDictionary as ProfileService serializer anymore.

	* RestHandler.cs: do not use
	LazyDictionary as the Exception or NameValueCollection serializer
	anymore.

2008-09-23  Marek Habersack  <[email protected]>

	* JavaScriptSerializer.cs: removed the LazyDictionary class, it's
	not needed anymore.


svn path=/trunk/mcs/; revision=113832
2008-09-23 14:55:49 +00:00
Juraj Skripsky 0594b0199e 2008-09-23 Juraj Skripsky <[email protected]>
* JsonSerializer.cs: "SerializeGenericDictionary" is an instance method,
	fix retrieval of its MethodInfo.
	Initialize serializeGenericDictionaryMethods (lazily).
	Add and use GetClosedIDictionaryBase to also handle cases where a
	non-generic class implements a closed IDictionary<,> (e.g.
	SomeDictionary : IDictionary<string, object>). Fixes bug #424704.
	First check for IDictionary<,>, then for IDictionary.

2008-09-20  Juraj Skripsky  <[email protected]>

	* JavaScriptSerializerTest.cs: added test for bug #424704.


svn path=/trunk/mcs/; revision=113829
2008-09-23 14:33:54 +00:00
Marek Habersack b9c7ab7bc0 2008-09-20 Marek Habersack <[email protected]>
* JsonDeserializer.cs: added support for stand-alone NaN, Infinity
	and -Infinity values, as well as the same within an array.

2008-09-20  Marek Habersack  <[email protected]>

	* JavaScriptSerializerTest.cs: added some tests

svn path=/trunk/mcs/; revision=113596
2008-09-19 22:41:46 +00:00
Marek Habersack 93a1d2ad6c 2008-09-19 Marek Habersack <[email protected]>
* Json.cs: added new Serialize overload which takes a TextWriter
	for its output parameter.
	Added Deserialize methods.

	* JsonSerializer.cs: made InitialJavaScriptDateTicks internal.
	Added new Serialize overload which takes a TextWriter for its
	output parameter.
	Added WriteValue overloads for float and double - they must not be
	converted to strings as IConvertibles because their Max/MinValue
	end up converted incorrectly.

	* JavaScriptSerializer.cs: adjustments for the new JSON
	(de)serializer.

	* JsonDeserializer.cs: new JSON deserializer code, fully compliant
	with the .NET AJAX one.

2008-09-19  Marek Habersack  <[email protected]>

	* JavaScriptSerializerTest.cs: enabled some tests which were
	failing with the old (de)serializer, but work with the new one.

2008-09-19  Marek Habersack  <[email protected]>

	* System.Web.Extensions.dll.sources: removed most of the
	Newtonsoft JSON code, leaving only ReflectionUtils and
	JavaScriptUtils.


svn path=/trunk/mcs/; revision=113590
2008-09-19 21:13:55 +00:00
Marek Habersack 5defc3fa29 2008-09-17 Marek Habersack <[email protected]>
* System.Web.Extensions.dll.sources: added
	System.Web.Script.Serialization/Json.cs,
	System.Web.Script.Serialization/JsonSerializer.cs and
	System.Web.Script.Serialization/StringBuilderExtensions.cs

	* System.Web.Script.Serialization/Json.cs: helper class to invoke
	de/serializer.

	* System.Web.Script.Serialization/JsonSerializer.cs: new
	implementation of Json serializer that is free of issues found in
	the old one (and faster + simpler).

	* System.Web.Script.Serialization/JavaScriptSerializer.cs: staging
	transition to the new Json (de)serializer. For now deserialization
	is done using the old JSON code, serialization uses the new
	serializer.

	* System.Web.Script.Serialization/StringBuilderExtensions.cs: a
	set of simple StringBuilder extension methods which check the size
	of the builder against some value and throw an exception if the
	value is exceeded.

svn path=/trunk/mcs/; revision=113254
2008-09-17 06:42:10 +00:00
Marek Habersack 0befa2bb02 2008-08-30 Marek Habersack <[email protected]>
* System.Web.Script.Serialization/JavaScriptSerializer.cs: if the
	target type is an IDictionary with value type of System.Object,
	make sure to NOT convert any values.
	Any values descendant from JavaScriptSerializer.LazyDictionary are
	converted to Dictionary <string, object>

svn path=/trunk/mcs/; revision=111956
2008-08-29 22:37:59 +00:00
Marek Habersack 6c2057c3ca 2008-08-28 Marek Habersack <[email protected]>
* System.Web.Script.Services/LogicalTypeInfo.cs: Invoke does not
	convert context to System.Object.
	If context is descendant from JavaScriptSerializer.LazyDictionary
	it is converted to a regular Dictionary <string, object> before
	passing to the service method.

2008-08-28  Marek Habersack  <[email protected]>

	* JsonSerializer.cs: each value stored in an enumerable is treated
	as a top-level object.

svn path=/trunk/mcs/; revision=111801
2008-08-28 13:13:35 +00:00
Marek Habersack 0e1e0d5903 2008-08-28 Marek Habersack <[email protected]>
* System.Web.Script.Serialization/JavaScriptSerializer.cs:
	correctly handle members which have an interface as their return
	type - several known interfaces are converted to implementing
	types.

svn path=/trunk/mcs/; revision=111772
2008-08-28 01:35:55 +00:00
Marek Habersack 128130fb6c 2008-08-22 Marek Habersack <[email protected]>
* JsonSerializer.cs: do not perform deep object serialization - it
	results in all kinds of problems (including too big size of the
	resulting string, recursion errors when two or more objects in the
	hierarchy hold a reference to some object) and is not what .NET
	code does. 
	Property name is written only after it is determined if we're
	serializing the property or not.
	Entire object is serialized only if it's the object requested for
	serialization by calling code.

2008-08-22  Marek Habersack  <[email protected]>

	* Test/System.Web.Script.Serialization/JavaScriptSerializerTest.cs:
	marked several of the JavaScriptSerializer tests as not
	working. Experiments show that the tests are invalid as they relay
	on behavior which is different to .NET's.

	* System.Web.Script.Serialization/JavaScriptSerializer.cs:
	GetConverter now checks whether the requested type is descendant
	from the type supported by teh converter.

svn path=/trunk/mcs/; revision=111421
2008-08-22 20:51:45 +00:00
Marek Habersack 16f4dc9082 2008-08-19 Marek Habersack <[email protected]>
* JsonSerializer.cs: implemented a work-around for a bug in the
	SerializedLazyDictionary which would fail to serialize a type if
	any of its properties would throw an exception.

svn path=/trunk/mcs/; revision=110984
2008-08-19 19:47:39 +00:00
Igor Zelmanovich 9b2b9d6420 merge r108947-108948
svn path=/trunk/mcs/; revision=108949
2008-07-27 16:40:30 +00:00
Jb Evain ba9108786a 2008-05-20 Jb Evain <[email protected]>
*.cs: all files from JSon.NET are now re-licensed under the
	MIT/X11 license, thanks to his author James Newton-King
	for relicensing them.

svn path=/trunk/mcs/; revision=103523
2008-05-19 22:24:40 +00:00
Konstantin Triger a344135835 convert ArrayList to array only in case of DeserializeObject()
svn path=/trunk/mcs/; revision=92838
2008-01-14 10:27:15 +00:00
R. Tyler Ballance 81d13bb3a6 Gak, forgot to move the code after the null check on 'type'`
svn path=/trunk/mcs/; revision=87848
2007-10-20 11:33:55 +00:00
R. Tyler Ballance 407dc6bc3f Fix for handling Nullable types in JSON deserialization
re #328836

svn path=/trunk/mcs/; revision=87847
2007-10-20 11:30:19 +00:00
Adar Wesley 56dd3d066a Added support for TypeResolver to JavaScriptSerializer.
Added relevant tests.

svn path=/trunk/mcs/; revision=85395
2007-09-06 09:32:54 +00:00
Konstantin Triger 3a12a9c2e9 fix enum serialization
svn path=/trunk/mcs/; revision=83075
2007-07-31 13:58:58 +00:00
Konstantin Triger 25a377d4c3 undo InvariantCulture fix for enums since 'Enum.ToString(System.IFormatProvider)' is obsolete
svn path=/trunk/mcs/; revision=83063
2007-07-31 09:12:04 +00:00
Konstantin Triger 063ae32b2e refactoring
svn path=/trunk/mcs/; revision=83054
2007-07-31 07:49:35 +00:00
Konstantin Triger 5e93de63d7 ensure CultureInfo.InvariantCulture is used everywhere
svn path=/trunk/mcs/; revision=83053
2007-07-31 07:42:40 +00:00
Konstantin Triger 772c5fd59e refactoring
svn path=/trunk/mcs/; revision=83052
2007-07-31 07:33:52 +00:00
Konstantin Triger 7253fb1adc refactoring
svn path=/trunk/mcs/; revision=83048
2007-07-31 06:49:08 +00:00
Adar Wesley 99aa850634 Implemented support for JavaScriptSerializer.MaxJsonLength and
JavaScriptSerializer.RecursionLimit.

svn path=/trunk/mcs/; revision=83000
2007-07-30 15:37:50 +00:00
Konstantin Triger 3baf413bb9 fixing DateTime serialization
svn path=/trunk/mcs/; revision=82988
2007-07-30 15:01:31 +00:00
Konstantin Triger fe410f7cc1 initial implementation for JavaScriptSerializer.MaxJsonLength, JavaScriptSerializer.RecursionLimit
svn path=/trunk/mcs/; revision=82757
2007-07-26 12:27:54 +00:00
Igor Zelmanovich 0fbd8e2b37 JavaScriptSerializer.Deserialize method returns correct type object.
javascripts array is deserialized into object[] type.

svn path=/trunk/mcs/; revision=81321
2007-07-04 07:49:55 +00:00
Konstantin Triger 5bfd9917ea support serialization of IDictionary<>; refactoring
svn path=/trunk/mcs/; revision=81190
2007-07-02 16:19:24 +00:00
Konstantin Triger fe62ab9fb5 correctly handle string escaping
svn path=/trunk/mcs/; revision=80971
2007-06-28 13:35:13 +00:00
Konstantin Triger b7037e9f77 correctly read \uXXXX escaped characters
svn path=/trunk/mcs/; revision=80969
2007-06-28 13:22:39 +00:00
Igor Zelmanovich 940a290249 added DefaultSerializer property for internal use
svn path=/trunk/mcs/; revision=80620
2007-06-24 12:25:27 +00:00
Konstantin Triger 74cb159088 implemented DeserializeObject
svn path=/trunk/mcs/; revision=80506
2007-06-21 18:24:28 +00:00
Konstantin Triger f9fe8387c3 implemented JavaScriptConverter..Deserialize functionality
svn path=/trunk/mcs/; revision=80504
2007-06-21 18:16:26 +00:00
Konstantin Triger db56e73b59 implementation of converters for serialization
svn path=/trunk/mcs/; revision=80486
2007-06-21 15:30:02 +00:00
Konstantin Triger e5f6dc0ce4 remove commented out code
svn path=/trunk/mcs/; revision=80485
2007-06-21 15:25:21 +00:00
Konstantin Triger a763e0b947 Initial JavaScriptSerializer implementation
svn path=/trunk/mcs/; revision=79276
2007-06-12 14:39:43 +00:00