JSONUpdater
修改JSON文件通过执行一个或多个动作:
- 插入一个新值插入到JSON对象或数组
- 在一个JSON对象或数组替换现有值
- 合并两个JSON对象或数组的内容
- 从JSON对象或阵列中删除一个值
- 附加一个值到JSON数组
- 在重命名一个JSON对象的关键。
对于每一个文档的更新,一个JSON路径表达式用于识别JSON对象或阵列要被修改的位置。要改变它是第二参数名的特定对象键或数组索引。请注意,路径可能是指多个项目。如果是这样的话,所有的项目将被修改。
对于修饰替换现有项目或插入新的物品,两个参数被给予其指定值被添加到文档中。这个值可以作为一个简单的文本值,或者它可能是一个XQuery的表达,JSON对象或JSON数组。
该更新功能提供的文档更新操作中使用的属性值。该文献功能只用于提供JSON文件将被更新。
对于进入每个特征更新端口,所有变压器列出的更新操作都将被应用到通过输入变压器各功能文献港口。因此,任何更改将在JSON文件提出,如果没有的功能通过输入变压器更新港口。
请注意,如果直接输入到变压器的参数文件,可以以两种不同的方式处理:
- 如果不文献功能提供给变压器,新功能将被创建,用于存储文档。每个更新的将被应用到该文档,那么这将是通过输出文献港口。
- 如果文献特征被提供给变压器,每一个更新将被应用到该文档,并且这些特征将来自变压器的输出。
输入端口
![关闭](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Skins/Default/Stylesheets/Images/transparent.gif)
输入功能包含要修改的JSON文档。该文件可以包含在一个属性,直接进入变压器,或包含在属性值引用的文件。
![关闭](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Skins/Default/Stylesheets/Images/transparent.gif)
一种用于进入该输入端口的每个特征,每个变压器列出的更新将在其上经由输入的每个文件被执行文献输入端口。这些功能将包含在文档更新所使用的属性值。
输出端口
![关闭](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Skins/Default/Stylesheets/Images/transparent.gif)
该文献输入特征将通过此端口输出。这些功能将包含更新文件,将存储在结果属性参数命名的属性。
参数
变压器
![关闭](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Skins/Default/Stylesheets/Images/transparent.gif)
该参数用于指定哪些更新功能将修改文档。当这个参数设置为属性列表,文献特征将仅由被修改更新特点是共享这些属性的值相同。该文件将通过所有的具有相同的属性值更新功能进行修改。请注意,文件将不被如果没有更新更新与用于相同的值功能“组由”属性被提供给变压器。
![关闭](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Skins/Default/Stylesheets/Images/transparent.gif)
没有te:如何并行处理与FME作品:看关于并行处理了解详细信息。
该参数确定变压器是否应该执行跨并行进程的工作。如果启用,这个过程将启动由指定的每个组通过...分组参数。
并行处理水平
例如,一个四核机,最小的并行将导致两个同时FME过程。一个8芯机上极端并行将导致16个同步过程。
您可以使用此功能试验,并查看Windows任务管理器和工作台登录窗口中的信息。
![关闭](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Skins/Default/Stylesheets/Images/transparent.gif)
没有:这是默认的行为。处理将在ly occur in this transformer once all input is present.
按组: This transformer will process input groups in order.Changes on the value of the通过...分组parameter on the input stream will trigger batch processing on the currently accumulating group.This will improve overall speed if groups are large/complex, but could cause undesired behavior if input groups are not truly ordered.
JSON文件
![关闭](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Skins/Default/Stylesheets/Images/transparent.gif)
This parameter is used to specify the type of JSON document which is to be modified.该 JSON may come from the input features (Parameter Value: Text or Attribute), or it may come from an external file.(Parameter Value: JSON File)
![关闭](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Skins/Default/Stylesheets/Images/transparent.gif)
When the JSON Input parameter is set to ‘Text or Attribute’, this parameter is used to specify the JSON text.该 parameter may be set to an attribute value, or the JSON document may be entered into the parameter directly.
![关闭](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Skins/Default/Stylesheets/Images/transparent.gif)
When the JSON Input parameter is set to ‘JSON File’, this parameter is used to specify the location of the file.该 file path may be entered directly into the parameter, or the path may come from an attribute value.
更新
在更新表的每一行指定单个更新操作。
![关闭](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Skins/Default/Stylesheets/Images/transparent.gif)
This parameter specifies the type of modification to apply to the XML document.该 possible updates are:
更新 Type | Description |
---|---|
Insert Into Object |
Inserts a new key / value pair into an object.该 name of the key is taken from the ‘Object/Array Index’ column.该 inserted value is taken from the Value parameter. |
Merge Objects |
Copies all the key / value pairs from one object into another.如果 the Value parameter is not a JSON object, or an XQuery expression which evaluates to a object, the update will fail. |
Insert Into Array |
Inserts a new value into an array, at a specified position.该 array position (which starts counting at 0) is taken from the ‘Object/Array Index’ column, and should be an integer.该 new value is taken from the Value column. |
Append to Array |
Appends a new value to the end of an array. |
Merge Arrays |
Copies all values from one array into another.如果 the Value parameter is not a JSON array, or an XQuery expression which evaluates to an array, the update will fail. |
Replace Object Value |
Replaces the value of an object key.该 key whose value is to be replaced is taken from the ‘Object/Array Index’ parameter. |
Replace Array Value |
Replaces the value at a specified position within an array.该 array index of the value to replace is taken from the ‘Object/Array Index’ column.该 index should be an integer.Array indices being counting at 0. |
Rename Object Key |
Changes an object key name.该 key to rename is taken from the ‘Object/Array Index’ parameter. |
Delete from Object |
Removes a key / value pair from an object.该 key which is to be removed is taken from the ‘Object/Array Index’ parameter. |
Delete from Array |
Removes a value from an array.该 array index of the value to remove is taken from the ‘Object/Array Index’ column.该 index should be an integer.Array indices being counting at 0. |
![关闭](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Skins/Default/Stylesheets/Images/transparent.gif)
This parameter is used to identify the JSON object or array which is to be updated.For updates which modify a specific object key or array index, the key / index is identified using the ‘Object/Array Index’ parameter.
JSON paths use a simple text syntax to trace a route through a JSON document, from the top level object or array, down to the object or array which is being modified.
All JSON documents must have a single object or array as the root value.In a JSON path, this root value is identified by the ‘json’ keyword.Thus, every JSON path begins with this keyword.Square bracket syntax is used to identify each level of the path.
An integer can be used to identify a position within an array:
- JSON [0] - 如果根值是一个数组,该路径是指该阵列中的第一个值。如果根值是一个对象,这条路不会解决任何价值。
- JSON [4] - 如果根值是一个数组,该路径是指在阵列中的第五个值。
A quoted string can be used to refer to the value of an object key:
- JSON [“位置”] - 如果根值是一个对象,该路径是指在对象中的“位置”键的值。如果根值是一个数组,该路径将无法解析为任何值。
- JSON [“特征”] - 指的根对象的“功能”键的值。
该se indices may be repeated, to have the path go deeper into the JSON document.It is important to know the structure of the document, so that the types of indices (object or array) are correct.
- JSON [0] [“所在地”] - 此路径是指在根阵列中的第一个元素的“位置”对象密钥。
- JSON [“特征”] [0] [“位置”] - 此路径是指特征‘阵列的根对象的“中的第一个项目位置键’的值。例如,这可能适用于以下(在complete) document:
{
"features" : [
{ "location” : { ... } }
]
}
A wildcard may be used to refer to all elements of an array, or all values in an object.A * character is used to denote a wildcard.
- json[*] – If the root value is an array, this path refers to all values in the array.如果 the root value is an object, this path refers to the values of all keys in the object.
- json[*]["location"] – This path refers to the ‘location’ key of all child values of the root object or array.
- json["features"][*] – This path refers to all the values contained in the value of the ‘features’ key in the root object.
In order to use an attribute value in a JSON path, the @Value FME function should be used.如果 the attribute value is an object key, the @Value function should be enclosed in quotes.
- json[@Value(index)] – This path refers to the item in the root array at the position indicated by the ‘index’ attribute.
- json["@Value(key)"] – This path refers to the object value whose key is named in the ‘key’ attribute.
没有te:该 @Value() functions used in the path parameter will apply to the更新feature being processed, not the文献feature that is being updated
![关闭](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Skins/Default/Stylesheets/Images/transparent.gif)
This parameter is used to specify the specific object key / array index whose value is to be inserted/removed/modified.
For object updates, this value of this parameter should be a string, which will be interpreted as an object key.Quotes are NOT required around the string in this parameter.
For array updates, the value of this parameter should be an integer.没有te that array indices start at 0.
![关闭](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Skins/Default/Stylesheets/Images/transparent.gif)
This parameter is used to indicate how the value of the Value parameter should be interpreted.该 effects of the different values of this parameter are explained in the description of the Value parameter.In general, this parameter should be set to Plain Text if the transformer is intended to insert text content into the document, while it should be set to JSON/XQuery if the transformer is intended to insert JSON objects or arrays into the document, or if the value is being produced through XQuery function calls.
![关闭](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Skins/Default/Stylesheets/Images/transparent.gif)
This parameter is used to specify the new values that should be inserted into the document.如果 the Value Type parameter is set to Plain Text, the contents of this parameter will be encoded for safe use in an XML document.That is, double quotes will be escaped as \", backslashes will be escaped as \\, and so on.
如果 the Value Type parameter is set to JSON/XQuery, the contents of this parameter will be interpreted as an XQuery expression.This allows the insertion of JSON values elements into the document.Also, this allows the use of the FME XQuery functions.For example, a JSON Template (for example, from theJSONTemplatertransformer) could be entered as the parameter value.It would then be evaluated before being inserted into the document.
没有te:Any FME XQuery functions used in the new value will access the更新feature, not the文献feature.
参数
![关闭](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Skins/Default/Stylesheets/Images/transparent.gif)
This parameter specifies whether or not Workbench should try to validate the attribute names which are passed to any XQuery functions used in the Value column.
![关闭](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Skins/Default/Stylesheets/Images/transparent.gif)
This parameter specifies the attribute to which the updated JSON document will be written.该 default is_result。
编辑变压器参数
使用一组菜单选项,变压器参数可以通过引用在工作区中的其它元件来分配。更先进的功能,如高级编辑,算术编辑,也是一些变压器可用。要访问这些选项的菜单,点击适用的参数旁边。欲了解更多信息,请参阅变压器参数菜单选项。
变压器分类
搜索FME知识中心
搜索样品和有关该变压器的FME知识中心。