Commit Graph
79 Commits
Author SHA1 Message Date
David Cantu 339b44734d Add support for preserve references on JSON (#655)
* Initial commit for JSON reference handling / preserve references

* Remove ReferenceHandling.Ignore option

* Code clean-up.

* Remove stale tests.

* Address PR feedback

* Reference handling inline (#1)

* Inline ReferenceHandling logic within main methods.

* remove stale Handle*Ref methods

* Refactor the code for Deserialization
* Create methods to reuse code
* Try to isolate Preserve logic as much as I can
* Replaced Exceptions for ThrowHelper methods

* Remove stale condition on $ref

* Add AggressiveInlining to HandlePropertyNameDefault

* Inline feature code in Serialization

* Fix preserve references for ExtensionData

* Split Reference dictionary into two, for (De)Serialize each.
Add Reference EqualityComparer to Serialize dictionary.

* Do not set PropertyName to s_missingProperty to avoid race condition issues.

* Remove Asserts that compare against an exception message.

* Set preserved array passing setPropertyDirectly = true to avoid issue when enumerable is already initialized.

* Code clean-up.

* Separate write code into WritePreservedObject and WriteReferenceObject

* Address some PR feedback:
* Switched ReferenceResolver to access it through a read-only property that initializes it the first time is tried to be accesed.
* Renamed some methods and properties
* Refactored WriteReference* methods.
* Fixed Exception messages
* Removed literal message comparison on tests.

* * Add round-tripping coverage to suitable unit tests
* Fix issues found with Round-tripping scenarios
  * Move DictionaryPropertyIsPreserved to EndProperty() in order to fix issue where two dictionary properties were next to each other and the DictionaryPropertyIsPreserved was not reset.
  * Add ReadStackFrame.IsNestedPreservedArray in order to identify preserved arrays nested and prevent using setPropertyDirectly on them.

* Add nullability annotations

* Code clean-up, reword comments and removed unnecesary properties in ReferenceHandling

* Fix issue where an object that tries to map into an enumerable could skip the validation that prevents this.

* Fix issue where the wrong type was passed into the throw helper for nested enumerable in HandleStartObject

* Address PR comments.

* Refactor flags on ReadStackFrame to avoid using unrelated fields for validation.

* Consolidated MetadataPropertyName enum logic on read and write.

* Reuse HandleStartObjectInEnumerable to handle arrays with metadata nested in a Dictionary.

* Refactor code:
* Change ReferenceResolver from class to struct to avoid one allocation.
* Replace propertyName.ToArray() for constant arrays in order to avoid allocation.

* Move some exception logic to the ThrowHelper class.

* * Apply optimizations:
  * Use PropertyCacheArray on Values property lookup.
  * Make Comparer static field to avoid one allocation at runtime.
* Document reasoning for DefaultReferenceResolver and ReferenreEqualsEqualityComparer

* Address PR comments.

* Addres more PR feedback:
* Add documentation to DefaultReferenceResolver public methods.

* Address PR feedback.

* Adderss more PR suggestions.

* * Move tests to Serialization namespace.
* On $values, set PropertyName on state.Current.JsonPropertyName instead.
2020-01-18 16:40:36 -08:00
buyaa-n 81bf79fd9a Annotate System.Text.Json for nullable (#528)
Annotate System.Text.Json for nullable
2019-12-31 12:01:19 -08:00
Anirudh Agnihotry 3b9abae5aa Removing "netcoreapp" and "netfx" TargetGroup (#457)
* netcoreapp -> netcoreapp5.0 in .sln files

* netcoreapp; -> netcoreapp5.0;  , netcoreapp- to netcoreapp5.0-

* netcoreapp- -> netcoreapp5.0 in .csproj

* 'netcoreapp -> 'netcoreapp5.0 in .csproj

* done with libraries sub folder

* missed semicolon

* minor changes

* netcoreapp -> netcoreapp5.0 in some extra files

* vNext target variable in configurations.props

* netcoreapp => netcoreapp5/0 in some other .props file

* netcoreapp -> vnext in .csproj

* making the netcorepap framework switch work

* fixing sendToHelix and linux build

* TargetFrameworkVNext -> netcoreappCurrent

* case correct netcoreappcurrent

* fixing send to helix zip path

* netfx -> net472 in .sln

* netfx; -> net472; in .props

* netfx- -> net472- in .props

* netfx - -> net472- in .csproj

* 'netfx-> 'net472 in .csproj

* netfx -> net472 manual change

* fixing ci build for netfx

* Not trying to change the global property

* Fixing build failure due to master changes in net https tests

* adding documentaiton and fixing filtering

* netcoreapp -> netcore5.0 in py file

* changing the path to use netcoreapp5.0 version

* feedback and override corefx path corrected in installers

* remaing netcoreapp5.0 changes done

* netcoreapp-> netcoreapp5.0 after live builds

* net472 -> netframeworkcurrent
2019-12-14 12:22:29 -08:00
Viktor Hofer d2999dc804 Remove versionless netstandard target group (dotnet/corefx#41984)
Commit migrated from https://github.com/dotnet/corefx/commit/26d7b6626ab0385a1158e674855f81ab73f628e0
2019-10-27 17:08:59 +01:00
Viktor Hofer 9b88ca1d72 Remove UAP target (dotnet/corefx#41759)
* Remove Uap target

* Remove RemoteInvokeForUap wrapper calls entirely

* Harvest S.D.SqlClient on UWP

* Disable UWP PInvoke analyzer

* Enable WindowsRuntime* tests on netcoreapp

Commit migrated from https://github.com/dotnet/corefx/commit/3b6ec2ba944fb72f921f95b99b6ebf2e7bb3dc5a
2019-10-17 15:04:39 +02:00
Anirudh Agnihotry d160e84b4c Removing Microsoft.bcl* packages (dotnet/corefx#41270)
* removing Microsoft.bcl packages

* targetframework conditions modified

* adding versionless config to avoid binplace

* uap standard conflicts

* remove package configurations

* negation if and remove exclude reference asset property

* adding choosing when statement

* using attribute

* Moveing packages to include to the common

* ChooseWhen -> IF


Commit migrated from https://github.com/dotnet/corefx/commit/99ea2b5aebf7361a5baa638c978cb6214fca5217
2019-10-04 16:44:56 -07:00
Katarzyna Bułat ae94173c63 JsonNode options (dotnet/corefx#41030)
* JsonNodeOptions added

* review comments included

* review comments included


Commit migrated from https://github.com/dotnet/corefx/commit/5bc2806f33090e78b38fafe4d5b46d5a0a4c1f08
2019-09-19 17:47:40 -07:00
Santiago Fernandez Madero ebce975828 Add missing dummy types to reference assemblies (dotnet/corefx#41147)
Commit migrated from https://github.com/dotnet/corefx/commit/4aea703673e942756c02b222e6b5babaf8612a25
2019-09-16 22:10:48 -07:00
Katarzyna Bułat 45c74fe7bf Writable JSON API changes (dotnet/corefx#40673)
* implicit operators moved to JsonNode
* JsonNull introduced
* JsonObject rewritten to use JsonObjectProperty
* JsonElement.ObjectEnumerator changed to use _current instead of _enumerator
* iterative DeepCopy implemented
* code reorganized
* parse implemented
* JsonDocumentOptions added to JsonNode.Parse
* WriteTo and ToJsonString added
* specification adjusted
* string comparison added
* JsosReadonlyDomWriteTests reused
* code coverage improved
* minor other fixes
* review comments included

Commit migrated from https://github.com/dotnet/corefx/commit/37b37395481b635c15eaa3454e52b72ab91de4ef
2019-09-09 14:53:38 -07:00
Viktor Hofer d5079dda17 Remove ProjectGUIDs from project files and Project and Name attributes from P2Ps (dotnet/corefx#40926)
* Remove ProjectGUIDs from P2Ps

* Remove ProjectGUIDs from project files

Commit migrated from https://github.com/dotnet/corefx/commit/c22714d65151968a17c3b232748880d5e7961dee
2019-09-09 18:21:25 +02:00
Katarzyna Bułat c3afc7f573 JsonArray and transformations API implementation (dotnet/corefx#40469)
* JsonArray added
* Transformations API added
* Review Comments included

Commit migrated from https://github.com/dotnet/corefx/commit/ad4fdd9cd3d99d0240fa53b9b7bdc23bb7a3f4a8
2019-08-26 15:51:04 -07:00
Steve Harter 59dde05950 Change 'type' to 'inputType' on serialize methods (dotnet/corefx#40372)
Commit migrated from https://github.com/dotnet/corefx/commit/9217d338671fe78d2bd31138a610bb9ad5a12608
2019-08-18 21:01:32 -07:00
Katarzyna Bułat 1ca7ec170b JsonObject implementation and tests (dotnet/corefx#40206)
* JsonObject implementation added
* JsonObject tests added
* JsonObject documentation added
* Review comments included

Commit migrated from https://github.com/dotnet/corefx/commit/ceaad9274f83273a4c95ec08b359253ad28bea1e
2019-08-14 15:19:05 -07:00
Katarzyna Bułat b82043d02d Json string and boolean (dotnet/corefx#40107)
* API to implement added
* JsonBoolean implementation added
* JsonString implementation added
* JsonBoolean tests added
* JsonString tests added
* review comments included
* 100% lines and branches covered
* framework fixes

Commit migrated from https://github.com/dotnet/corefx/commit/a7c0f966923d3379febe517be672c30c0aac63e4
2019-08-09 17:45:10 -07:00
Katarzyna Bułat a67b43bc04 Writable Json DOM - JsonNumber implementation and tests (dotnet/corefx#39917)
* Json prototype (dotnet/corefx#1)

Basic API for Json writable DOM with scenarios including collection initialization, accessing and modifying Json nodes.

* Json prototype - transformation API  (dotnet/corefx#2)

* transformation API added
* assertions to existing scenarios added

* Json prototype (dotnet/corefx#1)

Basic API for Json writable DOM with scenarios including collection initialization, accessing and modifying Json nodes.

* Json prototype - transformation API  (dotnet/corefx#2)

* transformation API added
* assertions to existing scenarios added

* JsonNumber implementation and tests (dotnet/corefx#3)

* IEquatables added
* JsonNumber implementation and unit tests added
* pragmas deleted
* review comments included, more tests added
* decimal support added to JsonNumber
* decimal support added to JsonArray and JsonObject

* all unimplemented classes and methods with accompanying tests removed

* First part of documentation added

* documentation completed

* missing exceptions added

* JsonElement changes removed

* part of the review comments included

* work on review comments

* code refactor

* more decimal tests added using MemberData

* more decimal tests added using MemberData

* more test cases added

* equals summary adjusted, equals tests added

* more Equals tests added, GetHashCode tests added, minor changes

* scientifing notation support added, rational numbers tests fixes

* rational overflow tests added

* ulong maxvalue tests added to rational types

* presision problems fixes

* exception strings fixed

* CI failing fixes (hopefully), review comments included

* missing == tests added to achieve 100% branch coverage

* review comments included

* trailing whitespaces fixes

* equals comments added

* equals object refactored to call quals json number

* merge fix


Commit migrated from https://github.com/dotnet/corefx/commit/5050ee83755eb07494d7d4ff6d759bc056ceb371
2019-08-09 01:23:00 +00:00
Steve Harter dc18bf41a8 Allow JsonConverterAttribute to be applied to an Enum (dotnet/corefx#39790)
Commit migrated from https://github.com/dotnet/corefx/commit/de61fb206e61f105f657ca01b1244580cc9e1e77
2019-07-26 12:20:30 -05:00
Steve Harter 20b0d3104d Add Encoder option to writer and serializer (dotnet/corefx#39524)
Commit migrated from https://github.com/dotnet/corefx/commit/bc10b53838bc84ac2b626e16eee1338183ee55c8
2019-07-16 09:29:20 -07:00
Stephen Toub b2ae1c1a85 Remove unnecessary "internal" from JsonConverterFactory ctor (dotnet/corefx#39504)
The ctor is already `protected`, so it can already be accessed by any derived type.  The only benefit adding `internal` would provide is so that it could be called directly by something else in the assembly, but the type is `abstract`, so that doesn't make sense for a ctor.

Commit migrated from https://github.com/dotnet/corefx/commit/902294e7933e84601aa4543fc3afe0dcf85c2d99
2019-07-15 20:14:02 -04:00
Jeremy Kuhne 1f8420b416 Make CreateConverter public and add options (dotnet/corefx#39438)
* Make CreateConverter public and add options

This is to facilitate composition with factory converters.

* Remove unnecessary using


Commit migrated from https://github.com/dotnet/corefx/commit/db543576d757f2d448f004f5e9ba2b77c2b497fe
2019-07-15 12:42:55 -07:00
Steve Harter 7adb86b94d Add UTF-8 APIs on TextEncoder and add JavascriptEncoder to JsonEncodedText (dotnet/corefx#39415)
Commit migrated from https://github.com/dotnet/corefx/commit/bbbcac59ac07f344ce4e257ef182a90c429d2b58
2019-07-15 09:39:58 -07:00
Vishnu Kumar 600528b6cc Add WriteTo API on JsonDocument and JsonProperty (dotnet/corefx#39367)
* Remove WriteProperty methods and rename WriteValue to WriteTo in JsonElement (dotnet/corefx#39037)

* Add WriteTo method in JsonDocument and JsonProperty (dotnet/corefx#39037)

* Remove all repeated tests from JsonDocument and JsonProperty for now.

* Added null check for Utf8JsonWriter parameter in WriteTo methods on JsonElement, JsonDocument and JsonProperty

* Code review changes


Commit migrated from https://github.com/dotnet/corefx/commit/798468fb39d869a96104306483ed6ef4d63738ca
2019-07-12 15:06:08 -07:00
Ahson Khan 7b95fed179 Move Comment token type within the TokenType enum. (dotnet/corefx#38950)
* Move Comment token type within the TokenType enum.

* Fix JsonTokenType to JsonValueType mapping.

* Moves Comment down after PropertyName and address feedback.


Commit migrated from https://github.com/dotnet/corefx/commit/8e5cacf4578feea6ffc533700bcd0e3ebd99c4e3
2019-06-26 19:01:47 +00:00
Ahson Khan 15cc402980 Do not pass ReadOnlySequence by "in" to the Utf8JsonReader. (dotnet/corefx#38930)
* Do not pass ReadOnlySequence by "in" to the Utf8JsonReader.

* Remove in from the new ctor as well.


Commit migrated from https://github.com/dotnet/corefx/commit/563bbef3ed9c7029238ae9dbaf61129deee3c53f
2019-06-26 11:59:32 -07:00
Ahson Khan 5b4f3b0558 Rename JsonValueType to JsonValueKind and JsonElement.Type to JsonElement.ValueKind. (dotnet/corefx#38943)
* Add JsonDocument.Write, JsonProperty.Write, and rename JsonValueTupe to
JsonValueKind.

* Add JsonDocument.Write API tests.

* Don't use GetPropertyRawBytes and add JsonProperty.Write API tests.

* Make GetPropertyRawValue private again.

* Remove the new Write APIs on JsonDocument, JsonProperty.


Commit migrated from https://github.com/dotnet/corefx/commit/f08256cbba2b249cc1e5ca67cf4a1c074adf035b
2019-06-26 11:58:52 -07:00
Steve Harter e170ea2d6a Remove converter Write() that takes property name (dotnet/corefx#38932)
Commit migrated from https://github.com/dotnet/corefx/commit/d33be8575490a723395f7fcce1be1fd735405406
2019-06-26 11:11:04 -07:00
Ahson Khan 71ad5b675a Add simpler Utf8JsonReader ctors that dont require JsonReaderState or IsFinalBlock. (dotnet/corefx#38868)
* Add simpler Utf8JsonReader ctors that dont require JsonReaderState or
IsFinalBlock.

* Update ctors and add tests for simple ctor.

* Address PR feedback.

* Implement the convenience ctor over the existing one.

* Update new tests to remove the BytesConsumed, Position usage.


Commit migrated from https://github.com/dotnet/corefx/commit/7f8333149a0f24fc3f007eefb976118cf9ab06c5
2019-06-26 10:49:53 -07:00
Ahson Khan ab9be70726 Rename JsonSerializer.Parse/ToString to Deserialize/Serialize. (dotnet/corefx#38933)
* Rename JsonSerializer.Parse/ToString to Deserialize/Serialize.

* Update the API names in source/tests.

* Update other API calls in the tests.


Commit migrated from https://github.com/dotnet/corefx/commit/32776a3e25aa5b47c96ea2dd588c2201ca18a048
2019-06-26 08:30:30 -07:00
Ahson Khan 6de4fb805a Remove BytesConsumed and Position from JsonReaderState. (dotnet/corefx#38928)
* Remove BytesConsumed and Position from JsonReaderState.

* Fix the tests that were not properly restoring state.

* Disable failing test that was written incorrectly, previously.


Commit migrated from https://github.com/dotnet/corefx/commit/faa6ab48904c98147bef5754b74eac1fb5fe1af0
2019-06-26 07:35:09 -07:00
Ahson Khan 52838374b4 Add JsonElement.WriteProperty that takes JsonEncodedText. (dotnet/corefx#38869)
* Add JsonElement.WriteProperty that takes JsonEncodedText.

* Add tests.

* Auto-gen the ref.


Commit migrated from https://github.com/dotnet/corefx/commit/5134166832b430ccf2d05193cda9036d9a55356b
2019-06-26 07:32:53 -07:00
Ahson Khan e0f16ab98a Add JsonDocumentOptions and use that instead of JsonReaderOptions. (dotnet/corefx#38866)
* Add JsonDocumentOptions and use that instead of JsonReaderOptions.

* Address PR feedback.

* Auto-generate the reference assembly.

* Auto-gen the ref from the source.

* Explicitly mark property getters as readonly.

* Cleanup and fix converter argument name to typeToConvert.


Commit migrated from https://github.com/dotnet/corefx/commit/e4d329737f0ab5c413c98a90ff485f91fd3f5fd0
2019-06-26 07:29:43 -07:00
Ahson Khan f6a044dd53 Add WritePropertyName standlone API on the Utf8JsonWriter. (dotnet/corefx#38864)
* Add WritePropertyName standlone API on the Utf8JsonWriter.

* Fix write indented, add more tests, and more debug.asserts.

* Remove _isProperty field and rely on _tokenType ==
JsonTokenType.PropertyName

* Auto-gen the ref.

* Address PR feedback.


Commit migrated from https://github.com/dotnet/corefx/commit/a5b35f5600b615d4f30c64183891c83fd76bf491
2019-06-25 22:07:36 +00:00
Ahson Khan 6348741a68 Add better validation for JsonCommentHandling enum and re-order the values. (dotnet/corefx#38622)
* Add validation for JsonCommentHandling enum.

* Address PR feedback.

* Fix typos and make the checks consistent.

* Add parameter name to the argument OOR exception and update tests.


Commit migrated from https://github.com/dotnet/corefx/commit/0691e5ffc5b569730688f0a61aa63555db2b1e47
2019-06-25 21:14:47 +00:00
Mandar Sahasrabuddhe c5365cb400 CoreFx dotnet/corefx#36125 (Try)Get for byte sbyte short ushort (dotnet/corefx#38469)
* CoreFx dotnet/corefx#36125 (Try)Get for byte sbyte short ushort

* Init out values on failure return paths.

* APIs in JsonElement and related tests

* More test cases, test bug fixes, code fixes


Commit migrated from https://github.com/dotnet/corefx/commit/b2af402ee9f169be00b4be09887e6db0dba2bff1
2019-06-25 12:03:33 -07:00
Jeremy Kuhne 183ba4946e Fix factory converters used as attributes (dotnet/corefx#38740)
* Fix factory converters used as attributes

Need to unpack the type specific converter when associating directly with a property.

Add default constructor to StringEnum converter.

* Move the factory unpack per feedback


Commit migrated from https://github.com/dotnet/corefx/commit/c6c1890ecd8e258f4a6e97a94e23881ed7a88392
2019-06-20 16:50:02 -07:00
Jeremy Kuhne 04872b04c0 String enum converter (dotnet/corefx#38702)
* String enum converter

Adds public converter for converting enums to strings and vice-versa.

* Address feedback.

* Missing a readonly

* Fix exception and swtich to ConcurrentDictionary

* Merge fixup


Commit migrated from https://github.com/dotnet/corefx/commit/66a18944db6d64b67adb1320d41004a9140babc1
2019-06-20 12:07:20 -07:00
Steve Harter ad9f6b3d56 Add back KeyValuePair functionality (dotnet/corefx#38700)
Commit migrated from https://github.com/dotnet/corefx/commit/98a5211f1e2b14ab42e52c28f9ca54d41d8e8751
2019-06-19 16:57:42 -07:00
Steve Harter f33959f58e Custom converter feature for JSON serializer (dotnet/corefx#38578)
Commit migrated from https://github.com/dotnet/corefx/commit/6b41813015ad0db7740523d65acfcd6a6d7b2df5
2019-06-19 11:27:09 -07:00
Jose Perez Rodriguez 755bd54da2 Removing the Manual reference file from System.Text.Json (dotnet/corefx#38409)
* Removing the Manual reference file from System.Text.Json

* Readd the netcoreapp and uap configurations so that we don't have to bring AsyncInterfaces package into the shared framework closure

* Revert param name change as per PR Feedback


Commit migrated from https://github.com/dotnet/corefx/commit/5b3d41c1c63c4ebd93af7e6482e954e104827884
2019-06-17 14:10:20 -07:00
Ahson Khan 3c30c4883c Update JsonSerializer and JsonElement APIs - drop "As" and parameter re-ordering (dotnet/corefx#38270)
* Update JsonSerializer and JsonElement APIs

* Fix the test since the call became ambiguous and overload resolution
picked the different overload.


Commit migrated from https://github.com/dotnet/corefx/commit/5c2ba765f55462dcc5e00179a34398fc70bf37b7
2019-06-05 14:49:59 -07:00
Ahson Khan a8a2143048 Moving the JsonSerializer to the root namespace - System.Text.Json (dotnet/corefx#38120)
* CHanging namespace for json serializer

* Update ref and namespace to react to recent changes.

* Auto-gen the ref.

* Remove unnecessary using directive that got added recently.


Commit migrated from https://github.com/dotnet/corefx/commit/7e0c5dd1927981131c370141c4ef44c0ebd26c05
2019-06-05 18:18:50 +00:00
Maryam Ariyan ab1d04e32a Adds JsonElement.ValueEquals / JsonProperty.NameEquals APIs, (dotnet/corefx#37911)
* - Rename Utf8JsonReader.TextEquals to Utf8JsonReader.ValueTextEquals
- Implement JsonElement.ValueEquals and add code coverage
- Reuse logic for JsonProperty and add code coverage
- improve header documentation
- cleanup tests

Commit migrated from https://github.com/dotnet/corefx/commit/f09135a373caa94eca1566f7ad497aaf19587140
2019-06-03 17:21:10 -07:00
Ahson Khan f72c30b7b7 Add JsonSerializer overload that takes Utf8JsonReader. (dotnet/corefx#38088)
* Initial commit of serializer overload that takes reader.

* Move utf8jsonreader api to a new file.

* Add more reader tests and update some exception cases.

* Add start of WriteValue API.

* Add the new files that were missed in previous commit.

* Remove writer related changes.


Commit migrated from https://github.com/dotnet/corefx/commit/1c1b78f7ec1d04aeac059d3d4e4c975d3a3ad23e
2019-05-31 11:57:15 -07:00
Jose Perez Rodriguez dcdbef726e Adding net461 target to Microsoft.Bcl.* packages (dotnet/corefx#38104)
* Adding net461 target to Microsoft.Bcl.* packages

* Adding System.Text.Json net461 target as well


Commit migrated from https://github.com/dotnet/corefx/commit/fdab38c206fe545b53d043f81be574cdbe9b5b8c
2019-05-31 11:43:52 -07:00
Ahson Khan bb18f7869f Add Base64 APIs to Utf8JsonReader, Utf8JsonWriter, and JsonElement (dotnet/corefx#38048)
* Add Utf8JsonWriter Base64 APIs.

* Add Utf8JsonReader Base64 APIs.

* Add JsonElement Base64 APIs.

* Update API shape based on review.

* Auto-generate the ref assembly.

* Address PR feedback so far.

* Add escaping step and update length counters accordingly.

* Add JsonWriter API tests.

* Add JsonReader and JsonElement tests.


Commit migrated from https://github.com/dotnet/corefx/commit/82408cd90f4d4573d502e8df2ca437b35e6a37f7
2019-05-30 22:13:31 -07:00
Maryam Ariyan 9ba8b91360 Make JsonPropertyNameAttribute.Name readonly (dotnet/corefx#37829)
Rename ctor arg to name

Fixes: dotnet/corefx#37552

Commit migrated from https://github.com/dotnet/corefx/commit/e8990ae04e4ef62f5ccb143352472c9b4d5d5968
2019-05-28 12:27:20 -07:00
Ahson Khan 17c9d54f25 Add Skip and TrySkip APIs to Utf8JsonReader with tests. (dotnet/corefx#37793)
* Add Skip and TrySkip APIs to Utf8JsonReader with tests.

* Auto-generate the ref assembly.

* Remove new lines and update bytes consumed to avoid adjusting OS specific offsets.

* Add IsFinalBlock public property.

* Break up the skip/try skip method into helpers.

* Add more direct tests and update impl to avoid unnecessary struct copy.


Commit migrated from https://github.com/dotnet/corefx/commit/2f2aca43ef9d24c794255c3ef5d0238dc479652b
2019-05-28 12:26:08 -07:00
Anirudh Agnihotry 84aa86c587 rename ToBytes to ToUtf8Bytes (dotnet/corefx#37912)
Commit migrated from https://github.com/dotnet/corefx/commit/4e342b94a06e21604cd805d0340ef871adc47c43
2019-05-24 11:50:12 -04:00
Mandar Sahasrabuddhe 3926f4411d Implement GetComment API (dotnet/corefx#35705)
* CoreFx dotnet/corefx#33347: Implement GetComment API

* Generate References as per correct steps

* Exclude delims & line separators, new unescape test

* Revert consume comment changes, test case fixes

* Partial revert of previous incorrect online merge

* fixed another online merge conflict resolution slippage

* Intermediate rebase from master

* Reworked files

* Reworked files 2

* Fix coding sytle as per review comments


Commit migrated from https://github.com/dotnet/corefx/commit/53aaaf3c848e4e737420de2b46f7cace397d730a
2019-05-20 19:25:22 -07:00
Ahson Khan 475d4d99b7 Add string-based WriteAsProperty overload to JsonElement. (dotnet/corefx#37789)
* Add string-based WriteAsProperty overload to JsonElement.

* Address PR feedback - remove UTF-16 from the comments.


Commit migrated from https://github.com/dotnet/corefx/commit/189766719a059512a515d488efc5c65c7abf0650
2019-05-20 02:57:17 -07:00
Steve Harter cf7d20adc4 Add extension data support to Json serializer (dotnet/corefx#37690)
Commit migrated from https://github.com/dotnet/corefx/commit/71487a4a5bf7c0043cca4672ff3352c098dabd8c
2019-05-17 07:56:47 -07:00