我正在尝试学习 DynamoDb 并尝试使用示例将数据从 json 加载到表中 Amazon developer guide但我遇到了以下异常:
com.fasterxml.jackson.databind.node.IntNode cannot be cast to com.fasterxml.jackson.databind.node.ObjectNode
在下面一行:
currentNode = (ObjectNode) iter.next();
你能告诉我我在这里做错了什么吗?
您还可以告诉我有什么方法可以使用 GUI 来查看我的表格内容吗?我在项目中使用 DynamoDbLocal 使用 maven。
谢谢
最佳答案
我的 json 文件中存在问题。我在输入文件中使用 json,如下所示:
{
"year" : "2013",
"title" : "Turn It Down, Or Else!",
"info" : {
"directors" : [
"Alice Smith",
"Bob Jones"
],
"release_date" : "2013-01-18T00:00:00Z",
"rating" : "6.2",
"genres" : [
"Comedy",
"Drama"
],
"image_url" : "http://ia.media-imdb.com/images/N/O9ERWAU7FS797AJ7LU8HN09AMUP908RLlo5JF90EWR7LJKQ7@@._V1_SX400_.jpg",
"plot" : "A rock band plays their music at high volumes, annoying the neighbors.",
"rank" : "11",
"running_time_secs" : "5215",
"actors" : [
"David Matthewman",
"Ann Thomas",
"Jonathan G. Neff"
]
}
}
虽然我的代码期望这样:
[
{
"year" : "2013",
"title" : "Turn It Down, Or Else!",
"info" : {
"directors" : [
"Alice Smith",
"Bob Jones"
],
"release_date" : "2013-01-18T00:00:00Z",
"rating" : "6.2",
"genres" : [
"Comedy",
"Drama"
],
"image_url" : "http://ia.media-imdb.com/images/N/O9ERWAU7FS797AJ7LU8HN09AMUP908RLlo5JF90EWR7LJKQ7@@._V1_SX400_.jpg",
"plot" : "A rock band plays their music at high volumes, annoying the neighbors.",
"rank" : "11",
"running_time_secs" : "5215",
"actors" : [
"David Matthewman",
"Ann Thomas",
"Jonathan G. Neff"
]
}
}
]
关于java - com.fasterxml.jackson.databind.node.IntNode 无法转换为 com.fasterxml.jackson.databind.node.ObjectNode,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56036098/