-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #227 from GenieFramework/hh-jsontext
interoperability for Stipple.JSONText and JSON.JSONText
- Loading branch information
Showing
5 changed files
with
60 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# garantee interoperability of different JSONTText definitions of JSON3 and JSON | ||
|
||
JSON.JSONText(json::Stipple.JSONText) = JSON.JSONText(json.s) | ||
JSON.show_json(io::JSON.Writer.CompactContext, s::JSON.Writer.CS, json::Stipple.JSONText) = write(io, json.s) | ||
JSON.Writer.lower(json::Stipple.JSONText) = json.s | ||
|
||
Stipple.JSONText(json::JSON.JSONText) = Stipple.JSONText(json.s) | ||
@inline StructTypes.StructType(::Type{JSON.JSONText}) = JSON3.RawType() | ||
@inline StructTypes.construct(::Type{JSON.JSONText}, json::JSON3.RawValue) = JSONText(string(json)) | ||
@inline JSON3.rawbytes(json::JSON.JSONText) = codeunits(json.s) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module StippleJSONExt | ||
|
||
using Stipple | ||
using JSON | ||
|
||
# garantee interoperability of different JSONTText definitions in Stipple and JSON | ||
# for both JSON3 and JSON | ||
# Note that `lower` for Stipple.JSONText is not defined as parse(json.s), because that would require | ||
# pure proper JSON. For transmissions of bindings, though, we need to allow to pass object names. | ||
|
||
JSON.JSONText(json::Stipple.JSONText) = JSON.JSONText(json.s) | ||
JSON.show_json(io::JSON.Writer.CompactContext, s::JSON.Writer.CS, json::Stipple.JSONText) = write(io, json.s) | ||
JSON.Writer.lower(json::Stipple.JSONText) = json.s | ||
|
||
Stipple.JSONText(json::JSON.JSONText) = Stipple.JSONText(json.s) | ||
@inline StructTypes.StructType(::Type{JSON.JSONText}) = JSON3.RawType() | ||
@inline StructTypes.construct(::Type{JSON.JSONText}, json::JSON3.RawValue) = JSONText(string(json)) | ||
@inline JSON3.rawbytes(json::JSON.JSONText) = codeunits(json.s) | ||
|
||
end |
This file contains 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
This file contains 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