I am trying to extract problems from Jira and put them in a List [Issue]. I figured out how to download and parse JSON:
val json = JsonParser.parse(content)
I can also extract some numbers in the root of JSON:
val total = (json \ "total").extract[Int]
val maxResults = (json \ "maxResults").extract[Int]
println("Received " + total + " from " + maxResults + " issues")
But when I try to extract a list of all the problems
val issues = (json \ "issues")
println(issues)
issues.extract[List[Issue]]
I get an error: Exception in thread "main" net.liftweb.json.MappingException: no useful value for id I don’t know how to convert JString (13604) to int I don’t understand why it cannot convert 13604 to Int. Here is my case class:
case class Issue(id: Int,
key: String,
summary: String,
issueTypeName: String,
resolutionName: Option[String],
resolutionDate: Option[DateTime],
timeSpent: Option[Int],
creatorName: String,
reporterName: String,
updated: DateTime,
created: DateTime,
priorityName: String,
description: String,
dueDate: Option[DateTime],
statusName: String,
assigneeName: String,
projectId: Int,
projectKey: String,
projectName: String,
timeEstimate: Option[Int],
ownerName: String,
timeOriginalEstimate: Option[Int]
)
Can someone help me with this Int problem?
, JSON , , , . json \ "issues", - , , JSON , .
?
, - :
(issue < - issues) { val id = (issue\ "id" ). extract [Int] Println (ID)
}
issue \ "project" \ "id" , Case Class List var (, , ). :
Error:(53, 16) value foreach is not a member of net.liftweb.json.JsonAST.JValue
for(issue <- issues) {
^
Scala Java, .
PS. id String case, :
Exception in thread "main" net.liftweb.json.MappingException: No usable value for summary Did not find value which can be converted into java.lang.String
, "summary" "". , - :
2. ?
:
3. Int id - ?