add JSONText methods for Symbol and JSONText#427
Open
hhaensel wants to merge 1 commit intoJuliaIO:masterfrom
Open
add JSONText methods for Symbol and JSONText#427hhaensel wants to merge 1 commit intoJuliaIO:masterfrom
hhaensel wants to merge 1 commit intoJuliaIO:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #427 +/- ##
==========================================
+ Coverage 90.26% 90.27% +0.01%
==========================================
Files 7 7
Lines 1366 1368 +2
==========================================
+ Hits 1233 1235 +2
Misses 133 133 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
quinnj
reviewed
Jan 30, 2026
| struct JSONText | ||
| value::String | ||
| end | ||
| JSON.JSONText(js::Symbol) = JSONText(String(js)) |
Member
There was a problem hiding this comment.
This definition feels really weird/unnecessary to me (who has valid json as a symbol?). I think I'd prefer to not support for now. I think the other definition is fine.
Contributor
Author
There was a problem hiding this comment.
I've written a Julia to JS expression conversion where I use Symbols to mean js variables, e.g.
julia> @jsexpr(:x^2 + :b * :y + 2)
JSExpr("(((x ** 2) + (b * y)) + 2)")In this context it comes in very handy to automatically convert Symbols to JSONText.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In some contexts it would be beneficial to have JSONText constructors for Symbol and JSONText arguments. What do you think about the following defintions?
I think it doesn't hurt and only adds methods that a user would expect to work as defined.