Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch more over to System.Text.Json #9819

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

dellis1972
Copy link
Contributor

@dellis1972 dellis1972 commented Feb 21, 2025

  • JsonElement is read only. This is why we convert them to JsonNode.
  • JsonNode.Parse does NOT have the same features as JsonDocument.Parse. e.g you CANNOT tell it to ignore trailing comma's. It will just throw an exception. This is the reason why we have to load the .json via JsonDocument and then call the extension method .ToNode () on the Root JsonElement to convert it to a JsonNode. (We use JsonNode to do the merging).

@dellis1972 dellis1972 force-pushed the dev/dellis1972/systemtextjson branch from 06ec5dd to 7fda7e5 Compare February 21, 2025 16:42
@@ -60,54 +60,53 @@ public class BuildAppBundle : BundleTool
};

[Required]
public string BaseZip { get; set; }
public string BaseZip { get; set; } = "";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunate side effect of using CoPilot. It changes other things and not just the stuff you asked it to 🤷

@dellis1972
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

public List<Package>? Packages { get; set; }
}

public class Package
{
[JsonProperty ("javaId")]
[JsonPropertyName ("javaId")]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jonathanpeppers are these needed if we have a JsonSerializerContext? Its not clear in the docs

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would put "JavaId" in the JSON without the attribute.

There might be a global setting though, for camelCase vs ProperCase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants