Last active
April 23, 2018 16:13
-
-
Save premnirmal/60f0784468f7cf18bb51b59392020b1e to your computer and use it in GitHub Desktop.
NutritionalInfo with correct annotations
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
import com.squareup.moshi.Json | |
/** | |
* Class representing a recipe's nutritional information. | |
* The [calories_per_serving] field here includes the correct annotations for Moshi to be able to parse it. | |
*/ | |
data class NutritionalInfoNet( | |
@JvmField | |
var id: String, | |
@JvmField | |
var recipe_id: String, | |
@JvmField | |
@field:Json(name = "calories-per-serving") // SUCCESS! | |
@Json(name = "calories-per-serving") | |
var calories_per_serving: String, | |
@JvmField | |
var media: List<AssetNet>) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment