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

x.json2: add encoder support for time.Time #20228

Merged
merged 4 commits into from
Dec 20, 2023

Conversation

Delta456
Copy link
Member

This PR adds support for time.Time for x.json2,'s encode_any function.

Code:

import x.json2
import time

fn main() {
    println(json2.encode({
        'bro': json2.Any(time.now())
    }))
}

Output:

{"bro":"2023-12-20T12:32:50.379Z"}

@spytheman spytheman merged commit 94d2881 into vlang:master Dec 20, 2023
42 checks passed
@Delta456 Delta456 deleted the json2_encoder_support_time branch December 20, 2023 16:02
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