Skip to content
This repository has been archived by the owner on Jan 27, 2025. It is now read-only.

Commit

Permalink
Second lookup error #102
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasNx committed Mar 22, 2022
1 parent daf0394 commit 4f82d96
Show file tree
Hide file tree
Showing 20 changed files with 182 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"animals" : [ {
"name" : "Jake",
"classification" : {
"type" : "mammal"
}
}, {
"name" : "Blacky",
"classification" : {
"type" : "bird"
}
} ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"animals": [{
"name": "Jake",
"classification": {
"type": "dog"
}
},{
"name": "Blacky",
"classification": {
"type": "parrot"
}
}]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dog mammal
cat mammal
parrot bird
shark fish
dragon fictional animal
unicorn fictional animal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lookup("animals[].*.classification.type", "./mapfile.tsv", "sep_char":"\t")
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FLUX_DIR + "input.json"
|open-file
|as-records
|decode-json
|fix(FLUX_DIR + "test.fix")
|encode-json(prettyPrinting="true")
|write(FLUX_DIR + "output-metafix.json")
;
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"animals" : [ {
"name" : "Jake",
"classification" : {
"type" : "mammal"
}
}, {
"name" : "Blacky",
"classification" : {
"type" : "bird"
}
}, {
"name" : "Jens",
"classification" : {
"type" : "human"
}
} ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"animals": [{
"name": "Jake",
"classification": {
"type": "dog"
}
},{
"name": "Blacky",
"classification": {
"type": "parrot"
}
}, {
"name": "Jens",
"classification": {
"type": "human"
}
} ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dog mammal
cat mammal
parrot bird
shark fish
dragon fictional animal
unicorn fictional animal
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
do list(path: "animals[]")
lookup("classification.type", "./mapfile.tsv", "sep_char":"\t")
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FLUX_DIR + "input.json"
|open-file
|as-records
|decode-json
|fix(FLUX_DIR + "test.fix")
|encode-json(prettyPrinting="true")
|write(FLUX_DIR + "output-metafix.json")
;
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"test" : [ "dog", "parrot", "human" ],
"animals" : [ {
"animal" : "dog",
"classification" : {
"type" : "mammal"
}
}, {
"animal" : "parrot",
"classification" : {
"type" : "bird"
}
}, {
"animal" : "human",
"classification" : {
"type" : "human"
}
} ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"test" : [ "dog", "parrot", "human" ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dog mammal
cat mammal
parrot bird
shark fish
dragon fictional animal
unicorn fictional animal
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
set_array("animals[]")
do list(path: "test[]", "var": "$f")
copy_field("$f", "animals[].$append.animal")
copy_field("$f", "animals[].$last.classification.type")
end

do list(path: "animals[]")
lookup("classification.type", "./mapfile.tsv", "sep_char":"\t")
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FLUX_DIR + "input.json"
|open-file
|as-records
|decode-json
|fix(FLUX_DIR + "test.fix")
|encode-json(prettyPrinting="true")
|write(FLUX_DIR + "output-metafix.json")
;
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"test" : [ "dog", "parrot", "human" ],
"animals" : [ {
"animal" : "dog",
"classification" : {
"type" : "mammal"
}
}, {
"animal" : "parrot",
"classification" : {
"type" : "bird"
}
}, {
"animal" : "human",
"classification" : {
"type" : "human"
}
} ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"test" : [ "dog", "parrot", "human" ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dog mammal
cat mammal
parrot bird
shark fish
dragon fictional animal
unicorn fictional animal
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
set_array("animals[]")
do list(path: "test[]", "var": "$f")
copy_field("$f", "animals[].$append.animal")
copy_field("$f", "animals[].$last.classification.type")
end

lookup("animals[].*.classification.type", "./mapfile.tsv", "sep_char":"\t")
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FLUX_DIR + "input.json"
|open-file
|as-records
|decode-json
|fix(FLUX_DIR + "test.fix")
|encode-json(prettyPrinting="true")
|write(FLUX_DIR + "output-metafix.json")
;

0 comments on commit 4f82d96

Please sign in to comment.