Giter Site home page Giter Site logo

Comments (6)

blag001 avatar blag001 commented on June 8, 2024

Anything new on this subject ?

It's really a bug more than an enhancement for me :/

As for now, there is no way to build the flowing JSON :

[
  {
    "id":1
    "payload": [
      {"value": "123"},
      {"value": "456"}
    ]
  },
  {
    "id":2
    "payload": []
  }
]

from talendcomp_tjsondoc.

jlolling avatar jlolling commented on June 8, 2024

I will check that now. In my projects this was not an issue because we do not expect an empty array - actually I was forced to remove empty arrays.

from talendcomp_tjsondoc.

jlolling avatar jlolling commented on June 8, 2024

I have checked this issue and I do not have a solution which creates and empty array by the data from the referencing components via foreign key relations in case of there is no child record.
The problem is because I have no record I do not have a foreign key and cannot address the parent object. The only way is to write an empty array while writing the parent object.
I am thinking about a function which checks at the end of the flow to add empty arrays for not referenced parent objects.

from talendcomp_tjsondoc.

jlolling avatar jlolling commented on June 8, 2024

You can use a workaround (actually it is a good solution) and add the empty array just in the parent object while filling it.
You could write simply the "payload" attribute in the parent with "[]" as value and mark this column as "Is a JSON object" (means it will take this empty array as real array and not as String.

from talendcomp_tjsondoc.

blag001 avatar blag001 commented on June 8, 2024

I'll try that now, I was playing with an empty List in my tMap for the parent, but without success.

The string [] as JSON didn't hit my mind, but that'll probably do exactly what I want.

This is a great set of component you've made ;)
If I figure exactly how everything work, I'll probably make a pull request to improve the example documentation, if you don't mind.

BTW, The compatibility is for 6.*, but I'm using it with 5.6 without any problem, do you know some bug with 5.6 or it's just not officially supported ?

from talendcomp_tjsondoc.

jlolling avatar jlolling commented on June 8, 2024

This component works also in 5.x projects. I have a customer doing that.

from talendcomp_tjsondoc.

Related Issues (20)

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.