Skip to content

Instantly share code, notes, and snippets.

@premnirmal
Last active April 23, 2018 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save premnirmal/60f0784468f7cf18bb51b59392020b1e to your computer and use it in GitHub Desktop.
Save premnirmal/60f0784468f7cf18bb51b59392020b1e to your computer and use it in GitHub Desktop.
NutritionalInfo with correct annotations
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