Create a key without a name

Hello everyone :slight_smile:

I just got a little case that I’m not able to resolve.

I’m working on a JSON where I’m doing a lot of transformation with set nodes for example.

I’m finally ending with a lot of useless key that I’m not able to delete.

For example, on my screenshot I got two keys that I would like to remove (properties, property), while keeping the structure.

I tried for example to put “{{ " " }}” as a value name, but I still got a space " " as name, while I want to have nothing.

Do you have any idea on how can I manage this?

Many thanks!!! :smiley_cat:

Any chance if you can please provide your input JSON in code/text format?

Sure!

Here is the input :

[
  {
    "properties": {
      "property": {
        "withoutVisit": true,
        "furnished": true,
        "propertySurface": 102,
        "bedroomsCount": 5,
        "floorNumber": 3,
        "totalFloorsNumber": 3,
        "roomsCount": 5,
        "maxTenantNumber": 5,
        "propertyType": "apartment",
        "announcementType": "flat_share",
        "building": {
          "address": " 2 rue de Bordeaux, 31000, Toulouse, FR",
          "city": "Toulouse",
          "zipCode": 31200,
          "country": "FR",
          "coordinates": {
            "latitude": 43.623779,
            "longitude": 1.437431
          }
        },
        "reference": "01-147 - Toulouse Bordeaux",
        "title": "Colocation Toulouse - 102 m2 - 5 chambres - À proximité immédiate des transports",
        "contactEmail": "[email protected]",
        "description": "Colocation Toulouse - 102 m2 - 5 chambres - À proximité immédiate des transports, commerces et Universités\n\n- Appartement rénové - 102 m2 - 5 chambres\n- Visite virtuelle disponible sur demande\n- Grand salon de 30m2\n- Un loyer charges comprises : eau, internet, électricité, chauffage - Eligible aux APL !\n\nL’APPARTEMENT :\n\n- Superficie : 102 m2 loi Carrez\n- 5 chambres disponibles\n- Une balcon aménagée\n- Deux salles d’eau et deux WC indépendants\n- Entièrement meublée et équipée (liste complète des équipements sur demande)\n\nLOCALISATION ET TRANSPORT :\n\n- A 7 min. à pied du métro ligne B (Arrêt : Minimes-Claude Nougaro et Barrière de Paris)\n\nBail classique de colocation\n\nLoyer 435€ sans charges + 65€ par locataire (Charges : eau, internet, électricité, chauffage)\n\nDépôt de garantie : 1 mois de loyer CC\n\nÉLIGIBLE APL"
      },
      "rooms": [
        {
          "propertyReference": "01-147 - Toulouse Bordeaux",
          "rooms": {
            "surface": 9,
            "reference": "Toulouse Bordeaux - Unit 1",
            "bedroomDescription": "Colocation Toulouse - 102 m2 - 5 chambres - À proximité immédiate des transports, commerces et Universités\n\n- Appartement rénové - 102 m2 - 5 chambres\n- Visite virtuelle disponible sur demande\n- Grand salon de 30m2\n- Un loyer charges comprises : eau, internet, électricité, chauffage - Eligible aux APL !\n\nL’APPARTEMENT :\n\n- Superficie : 102 m2 loi Carrez\n- 5 chambres disponibles\n- Une balcon aménagée\n- Deux salles d’eau et deux WC indépendants\n- Entièrement meublée et équipée (liste complète des équipements sur demande)\n\nLOCALISATION ET TRANSPORT :\n\n- A 7 min. à pied du métro ligne B (Arrêt : Minimes-Claude Nougaro et Barrière de Paris)\n\nBail classique de colocation\n\nLoyer 435€ sans charges + 65€ par locataire (Charges : eau, internet, électricité, chauffage)\n\nDépôt de garantie : 1 mois de loyer CC\n\nÉLIGIBLE APL",
            "bedType": "double",
            "rent": {
              "rentWithoutExpensesAmount": 46000,
              "expensesAmount": 7000,
              "depositAmount": 53000,
              "expensesDetails": {
                "electricity": true,
                "hotWater": true,
                "coldWater": true,
                "heating": true,
                "internet": true,
                "household": false,
                "gas": true,
                "condoFees": true
              }
            },
            "availabilities": [
              {
                "startDate": "2023-06-08",
                "minimumDuration": 1
              }
            ]
          }
        },
      ]
    }
  },
]

not sure if my understanding is correct, but something in the lines of

  1. Start your workflow with an HTTP Request node or any other node that provides the JSON payload.
  2. Add a Set node after the initial node.
  3. In the Set node, set the Operation to “Delete” and the Path to $.properties.property.
  4. Connect the Set node to the next node in your workflow.

sorry I did not get updated on this. I found the solution yesterday by creating keys with no name in the Set node, example : {{ “” }}.

anyway, many thanks to you for your help!!

2 Likes

Thanks for posting your solution, @ineptie, and welcome to the community :tada: !

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.