Coder Social home page Coder Social logo

Comments (4)

robtweed avatar robtweed commented on June 27, 2024

Use this (recently added and not yet documented) syntax:

"abc": "{<code>}"

This means: replace with the value in the code property of the data source object if it exists. If the code property doesn't exist in the data source object, remove the abc property from the result object

from qewd-transform-json.

robtweed avatar robtweed commented on June 27, 2024

Another trick is within a function transform, return this to delete the result object:

"<!delete>"

from qewd-transform-json.

aimythgit avatar aimythgit commented on June 27, 2024

"abc": "{<code>}".
This feature did what was required.
Documenting for a better view
Instead of
"phone": "{{phone}}".
This would create an empty phone node if the phone is null or not found in the original document to transform.
Do
"phone": "{<phone>}"

from qewd-transform-json.

aimythgit avatar aimythgit commented on June 27, 2024

This needs to have another enhancement.

what is needed is a hybrid solution.
Lets assume there are two fields in the incoming data

given_name
family_name

The mapping changes given_name to firstName and family_name to lastName.

If we do
firstName: "{<given_name>}"
lastName: "{<family_name>}"

If the given_name is empty or null the map won't copy. The issue here is if we do change first_name once with a non null value and then if we want to remove this. The map would not allow the null value to be entered.

So this feature needs to be enhanced to the following
if a field is found in the input then the map should take it. If the field does have a null value then the map should put back the null value.

E.g
"given_name": "Mary"

next we give
"given_name": null
Here the expectation is the mapping should give "firstName": null. Currently it's removing this field as it treats a field with null value and a field not present as same.

if only data has only that field
"family_name": "Jane"

The mapping should only give
"lastName" : "Jane". Here it can removing firstName field correctly.

from qewd-transform-json.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.