-
Notifications
You must be signed in to change notification settings - Fork 108
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
Added json string interpolation #132
Conversation
I need to look at this a bit deeper before I merge, but some general comments:
An example of the interpolator via macro technique is here, if you are interested: |
Yes, @jutley and I have the pleasure of working together and I discussed similar issues with him. We both agree that making this a macro definition would make this project much more complex but also make the resulting interpolator much more useful. We also discussed how variable interpolation needs to tap into the notion of a JsonCodec to have a smarter behavior than calling the variables toString method. Jake is going to be working on this project as part of a goal he set for himself of contributing to an open source project written in Scala as part of his internship program here at WhitePages. Looking forward to seing what he comes up with. |
@jutley @jedesah Awesome, thanks for the help. I think this is definitely heading in the right direction, just probably needs to work with Codecs as you say. To help with the complexity of macro's etc... there are a few generic programming tools in shapeless (that we already depend on), that can sometimes do the same thing without the need to directly macro things. I am a bit busier than I would like at the moment, so probably can't help too much in the next few weeks - but I would also suggest jumping on irc, there are good people who are often able to point at similar examples in one of the freenode channels: #scalaz / #shapeless / #argonaut. |
There is a library using "macros + string interpolation" https://github.com/maffoo/jsonquote |
For what it's worth I recently added a macro-based, compile-time JSON string interpolator to circe: circe/circe#162 You've got a parser in the core library and don't need to support Scala.js, so your implementation could be a lot simpler. |
Using the syntax json"""{"key":$val}""" will automatically parse the string into Json using Parse.parse().
#81