使用 ScriptTransformRecord 将时间戳值更改为日期

问题描述 投票:0回答:1

您好,我正在尝试使用 apache nifi 中的 python y ScriptTransformRecord 进程将 json 中的数据从时间戳转换为日期,我该怎么做?

{
  "impressions_history_posts_seen" : [ {
    "string_map_data" : {
      "type_interaction" : "posts_viewed",
      "Author" : {
        "value" : "michis_chilean"
      },
      "Time" : {
        "timestamp" : 1705789168
      }
    }
  }, {
    "string_map_data" : {
      "type_interaction" : "posts_viewed",
      "Author" : {
        "value" : "karimee._____"
      },
      "Time" : {
        "timestamp" : 1705789185
      }
    }
  },

我有一些与此类似的JSON文件,我想更改时间戳值,我尝试了很多代码和很多解决方案,但我总是收到错误,我使用apache nifi 1.25

python json groovy etl apache-nifi
1个回答
0
投票

您可以使用 UpdateRecord 为此,请检查 https://nifi.apache.org/docs/nifi-docs/html/record-path-guide.html#format

© www.soinside.com 2019 - 2024. All rights reserved.