我正在尝试使用 NiFi 中的 EvaluvateJsonPath 处理器从 JSON 文件中获取属性值。
下面是示例 JSON 文件
{"widget": {
"debug": "on",
"window": {
"title": "Sample Konfabulator Widget",
"name": "main_window",
"width": 500,
"height": 500
},
"image": {
"src": "Images/Sun.png",
"name": "sun1",
"hOffset": 250,
"vOffset": 250,
"alignment": "center"
},
"text": {
"data": "Click Here",
"size": 36,
"style": "bold",
"name": "text1",
"hOffset": 250,
"vOffset": 100,
"alignment": "center",
"onMouseUp": "sun1.opacity = (sun1.opacity / 100) * 90;"
}
}}
Run Code Online (Sandbox Code Playgroud)
下面是我的配置。
预期的输出应该是“main_window”。但是我将整个 JSON 字符串作为输出。有人可以指出我正确的方向,这里出了什么问题?
更新:
这是流文件内容,我在队列中看到是 EvaluvateJsonPath 处理器的结果。
我知道我们可以通过以下命令从SparkSQL查询或创建Mysql表。
val data = sqlContext.read.jdbc(urlstring, tablename, properties)
data.write.format("com.databricks.spark.csv").save(result_location)
val dataframe = sqlContext.read.json("users.json")
dataframe.write.jdbc(urlstring, table, properties)
Run Code Online (Sandbox Code Playgroud)
像那样有什么方法可以放桌子吗?
我正在尝试合并一个包含多个对象的 JSON 文件。下面是我的原始 JSON 文件。
{
"applicant": {
"full-name": "Tyrion Lannister",
"mobile-number" : "8435739739",
"email-id" : "tyrionlannister_casterlyrock@gmail.com"
},
"product": {
"product-category" : "Credit Card",
"product-type" : "Super Value Card - Titanium"
}
}
Run Code Online (Sandbox Code Playgroud)
我将从其他来源获取更多 JSON 数据,如下所示。
{
"flags": {
"duplicate-flag" : "No"
"contact-flag" : "Yes"
}
}
Run Code Online (Sandbox Code Playgroud)
我的任务是将新的 JSON 作为新对象附加到旧的 JSON 记录中,如下所示。
{
"applicant": {
"full-name": "Tyrion Lannister",
"mobile-number" : "8435739739",
"email-id" : "tyrionlannister_casterlyrock@gmail.com"
},
"product": {
"product-category" : "Credit Card",
"product-type" : "Super Value Card - Titanium"
},
"flags": …
Run Code Online (Sandbox Code Playgroud)