Skip to content

Extend JSON.lower instead of JSON.print - #65

Merged
sglyon merged 1 commit into
JuliaPlots:masterfrom
TotalVerb:fw/json
Aug 22, 2016
Merged

Extend JSON.lower instead of JSON.print#65
sglyon merged 1 commit into
JuliaPlots:masterfrom
TotalVerb:fw/json

Conversation

@TotalVerb

Copy link
Copy Markdown
Contributor

In JSON v0.7.0 and beyond, overloads of _print are deprecated in favour of overloading the simpler lower function.

The new JSON tag is not yet merged; see JuliaLang/METADATA.jl#5988. I'll ping you when it is.

Comment thread src/json.jl Outdated

JSON._print(io::IO, state::JSON.State, d::Base.Dates.Date) =
JSON._print(io, state, "$(Base.Dates.year(d))-$(Base.Dates.month(d))-$(Base.Dates.day(d))")
JSON.lower(d::Base.Dates.Date) =

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Is there a reason you have this definition? I believe it is redundant with the one defined in JSON.jl.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah, I see that this feature was introduced only starting v0.5.1. Also, this version will serialize dates as 2016-8-19—the JSON version is 2016-08-19. I think the latter would probably work in your case too, in which case this line can be safely deleted.

@sglyon

sglyon commented Aug 19, 2016

Copy link
Copy Markdown
Member

This looks great, thanks! We can definitely get rid of that definition for Base.Dates.Date. Will merge when the tag has been merged to METADATA

Also delete obsolete `Date` serialization.
@TotalVerb

Copy link
Copy Markdown
Contributor Author

Should be good to merge now. Restarting travis.

@TotalVerb TotalVerb closed this Aug 22, 2016
@TotalVerb TotalVerb reopened this Aug 22, 2016
@TotalVerb TotalVerb changed the title (don't merge yet) Extend JSON.lower instead of JSON.print Extend JSON.lower instead of JSON.print Aug 22, 2016
@sglyon

sglyon commented Aug 22, 2016

Copy link
Copy Markdown
Member

Thank you! Failing test is my fault and has been fixed on master.

@sglyon
sglyon merged commit ec2af15 into JuliaPlots:master Aug 22, 2016
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