Jolt to remove the slashes and extract the nested json

37 Views Asked by At

I have some problem when tried to used JOLT for modify JSON. We are getting data in a nested array and the json has some slashes/backslashes

I need to remove the slashes and extract the nested json "datatag" and load it into table using nifi

Input 1

[
  {
    "json": "\",\"datatag\":{\"Item\":\"000000000010000057\",\"Location\":\"NL01\",\"ERPGoodsReceiptTimeIL\":\"0\",\"ERPLotSizeIncrementIL\":\"0\",\"ERPMinLotsizeIL\":\"0.000\",\"ERPPlannedDeliveryTimeIL\":\"1\",\"ERPProcurementTypeInput\":\"F\",\"U_SPL_PROC_TYPE\":\"\",\"U_ERPReOrderPointQuantity\":\"0\",\"U_ERPTargetInventory\":\"0.000\",\"U_ERPDOSTarget\":\"00\",\"U_Purchasing_Group\":\"\",\"U_LGPRO\":\"9300\",\"U_LGFSB\":\"9300\",\"OperationType\":\"INSERT\",\"TimeStamp\":\"Mar 13 2024 3:00PM\"},\"endtag\":\""
  },
  {
    "json": "\",\"datatag\":{\"Item\":\"000000000010015005\",\"Location\":\"NL01\",\"ERPGoodsReceiptTimeIL\":\"10\",\"ERPLotSizeIncrementIL\":\"1\",\"ERPMinLotsizeIL\":\"8.000\",\"ERPPlannedDeliveryTimeIL\":\"5\",\"ERPProcurementTypeInput\":\"E\",\"U_SPL_PROC_TYPE\":\"\",\"U_ERPReOrderPointQuantity\":\"0\",\"U_ERPTargetInventory\":\"0.000\",\"U_ERPDOSTarget\":\"00\",\"U_Purchasing_Group\":\"101\",\"U_LGPRO\":\"1000\",\"U_LGFSB\":\"2000\",\"OperationType\":\"INSERT\",\"TimeStamp\":\"Mar 13 2024 3:00PM\"},\"endtag\":\""
  },
  {
    "json": "\",\"datatag\":{\"Item\":\"000000000010000108\",\"Location\":\"NL01\",\"ERPGoodsReceiptTimeIL\":\"0\",\"ERPLotSizeIncrementIL\":\"0\",\"ERPMinLotsizeIL\":\"0.000\",\"ERPPlannedDeliveryTimeIL\":\"1\",\"ERPProcurementTypeInput\":\"F\",\"U_SPL_PROC_TYPE\":\"\",\"U_ERPReOrderPointQuantity\":\"0\",\"U_ERPTargetInventory\":\"0.000\",\"U_ERPDOSTarget\":\"00\",\"U_Purchasing_Group\":\"\",\"U_LGPRO\":\"9300\",\"U_LGFSB\":\"9300\",\"OperationType\":\"INSERT\",\"TimeStamp\":\"Mar 13 2024 3:00PM\"},\"endtag\":\""
  }
]

Any help in Jolt spec is much appreciated

1

There are 1 best solutions below

0
daggett On

sounds you need ReplaceText with parameters:

  • Search Value = \\"
  • Replacement Value = "