英文:
I tried Simple Jolt transformation but its not working
问题
抱歉,你提供的内容中包含HTML实体编码(如")和特殊字符,无法直接进行翻译。以下是经过翻译的内容,但仍包含HTML实体编码。如果需要去掉HTML实体编码,你可以在翻译后自行处理:
输入 :
{
"employer": [
{
"id": "98",
"place_id": "7871",
"name": "Iti-ha-cho"
}
]
}
期望输出 :
{
"id" : "98",
"place_id" : "7871",
"name" : "Iti-ha-cho"
}
Jolt规范 我尝试了但没有成功 :
{
"operation": "shift",
"spec": {
"employer": {
"id": "[&1].&",
"place_id": "place_id",
"name": "name"
}
}
}
英文:
I want to convert this data using jolt, I tried but it showing null as result
Input :
{
"employer": [
{
"id": "98",
"place_id": "7871",
"name": "Iti-ha-cho"
}
]
}
Expected Output :
{
"id" : "98",
"place_id" : "7871",
"name" : "Iti-ha-cho"
}
Jolt Spec I tried but didnt work :
{
"operation": "shift",
"spec": {
"employer": {
"id": "[&1].&",
"place_id": "place_id",
"name": "name"
}
}
}
答案1
得分: 1
当前问题是由于缺少方括号嵌套规范引起的,您不需要指定那些冗长的内容,只需要以下规范即可:
[
{
"operation": "shift",
"spec": {
"employer": {
"*": ""
}
}
}
]
因为您只想提取employer
数组的子内容。
英文:
While the current issue is due to missing square bracket nesting the spec, you don't need to specify those long stuff, just the following spec will suffice
[
{
"operation": "shift",
"spec": {
"employer": {
"*": ""
}
}
}
]
as you only want to extract the sub-content of the employer
array.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论