我在雪花文档中找不到任何可以执行此操作的函数。
我想使用JOLT转换库重命名嵌套在另一个数组中的数组中的字段.1.要重命名的一个字段是数组2中的顶级字段.要重命名的两个字段位于嵌套数组中
我尝试过使用通配符,但是他们没有给我预期的输出.我使用的是JOLT 0.0.22版本.
输入JSON:
{
"country": "usa",
"state": [
{
"stateName": "TX",
"location": "south",
"cities": [
{
"name": "Austin",
"pop": "1M"
},
{
"name": "Dallas",
"pop": "2M"
}
]
},
{
"stateName": "CA",
"location": "west",
"cities": [
{
"name": "SanFran",
"pop": "3M"
},
{
"name": "LosAngeles",
"pop": "4M"
}
]
}
]
}
Run Code Online (Sandbox Code Playgroud)
预期产出:
{
"country": "usa",
"state": [
{
"stateName": "TX",
"locatedIn": "south", // name change here
"cities": [
{
"cityname": "Austin", // name change here
"citypopulation": "1M" // …Run Code Online (Sandbox Code Playgroud) 当我这样做时,gcloud docker push 我收到以下错误。
denied: Unable to create the repository, please check that you have access to do so.
Run Code Online (Sandbox Code Playgroud)
gcloud info显示 gcloud 中配置的正确项目名称。
有人可以指导我解决这个问题吗?或者建议一个替代方案。
我尝试过不使用gcloud直接登录,登录成功但推送失败
$docker login -e 2983212121577-compute@developer.gserviceaccount.com -u oauth2accesstoken -p "$(gcloud auth print-access-token)" https://gcr.io
Flag --email has been deprecated, will be removed in 1.14.
Login Succeeded
$ docker push gcr.io/project/imagename
...
denied: Unable to create the repository, please check that you have access to do so.
Run Code Online (Sandbox Code Playgroud)
$ gcloud --版本 Google Cloud SDK 147.0.0
$ docker --version …
docker gcloud google-kubernetes-engine google-container-registry
由于 java 没有通用数组,我使用了将 Object 数组转换为类型参数的常规技巧。当我有一个正式的类型参数时,这工作正常,<T>但当我使用有界类型参数时则不然<T extends something>。
使用正式类型的以下代码工作正常
public class Deck <T> {
private T [] cards;
private int size;
public Deck () {
cards = (T []) new Object[52];
size = 0;
}
}
public class BlackJackGame {
Deck<BlackJackCard> deck;
public BlackJackGame() {
deck = new Deck<>();
populate (deck);
deck.shuffle();
}
}
public class BlackJackCard extends Card {
}
Run Code Online (Sandbox Code Playgroud)
以下使用有界类型的代码抛出错误
public class Deck <T extends Card> {
private T [] cards;
private int size;
public …Run Code Online (Sandbox Code Playgroud) 我必须转换的输入JSON如下:
{
"Business": [
{
"Label": "Entertainment",
"category": "Advert",
"weight": "",
"types": [
"T1",
"T2"
]
},
{
"Label": "FMCG",
"category": "Campaign",
"weight": "",
"types": [
"T9",
"T10"
]
}
]
}
Run Code Online (Sandbox Code Playgroud)
预期产出:
{
"Business": [
{
"Label": "Entertainment",
"category": "Advert",
"weight": "",
"types": "T1"
},
{
"Label": "Entertainment",
"category": "Advert",
"weight": "",
"types": "T2"
},
{
"Label": "FMCG",
"category": "Campaign",
"weight": "",
"types": "T9"
},
{
"Label": "FMCG",
"category": "Campaign",
"weight": "",
"types": "T10"
}
]
}
Run Code Online (Sandbox Code Playgroud)
我已经尝试了JOLT github帮助页面提供的不同JsonSpecs.但我无法解决这个问题.任何帮助或指示将不胜感激.