File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Preparation/JSON/Expand_Fields Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 45
45
"width" : " ONE" ,
46
46
"@visokiotype" : " CustomBlockSchema.BooleanCustomBlockPublicOption" ,
47
47
"defaultValue" : true
48
+ },
49
+ {
50
+ "name" : " fieldPrefix" ,
51
+ "title" : " Expanded Fields Prefix" ,
52
+ "description" : " Optional" ,
53
+ "groupTitle" : null ,
54
+ "width" : " ONE" ,
55
+ "@visokiotype" : " CustomBlockSchema.TextCustomBlockPublicOption" ,
56
+ "mandatory" : false ,
57
+ "defaultValue" : null
48
58
}
49
59
],
50
60
"blockOutputs" : [
Original file line number Diff line number Diff line change 11
11
# Get options
12
12
jsonField = omniscope_api .get_option ("jsonField" )
13
13
includeInput = omniscope_api .get_option ("includeInput" )
14
+ prefix = omniscope_api .get_option ("fieldPrefix" )
15
+
16
+ if prefix is None :
17
+ prefix = ""
14
18
15
19
# Function to parse JSON and add prefix to keys
16
20
def parse_json (row , jsonField ):
17
21
try :
18
22
json_dict = json .loads (row [jsonField ])
19
- return {f"{ jsonField } _ { k } " : v for k , v in json_dict .items ()}
23
+ return {f"{ prefix } { k } " : v for k , v in json_dict .items ()}
20
24
except (json .JSONDecodeError , TypeError ):
21
25
return {}
22
26
You can’t perform that action at this time.
0 commit comments