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

Add @:json via tink_json #7

Closed
wants to merge 2 commits into from
Closed

Conversation

benmerckx
Copy link
Member

Would something like this be ok? It makes things easier in tink_web to encode or decode parameters which are json encoded.

@benmerckx
Copy link
Member Author

Ok, this doesn't work as easy as I had hoped :) TypeCrawler continues crawling the type, resulting in "not implemented" warnings where you might for example want to encode an enum via tink_json.

@benmerckx
Copy link
Member Author

Closing this in favour of:

I mean I think we could make it so that tink.json.Serialized is a bit easier to use
i.e. it could have a proper @:from cast so that you can just stick in the data
and we could make sure it passes tink_querystring (you'll have to call theJsonField.parse() to get at the actual data)

@benmerckx benmerckx closed this Sep 27, 2017
@back2dos
Copy link
Member

Can you please open an issue for this though? ^^


#if tink_json
switch f.meta.getValues(':json') {
case [[]]: f.expr = macro tink.Json.parse(this.params.get(prefix));

Choose a reason for hiding this comment

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

Curious, why does it check for a two-dimension array here?

Copy link
Member

@kevinresol kevinresol Sep 28, 2017

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

In short, @:json(12) @:json(true, false) @:json will result in [[12], [true, false], []] so to speak (except that it's expressions, rather than constants).

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.

None yet

4 participants