Structure lines in Code 1 javascript

Can someone help me structure it in javascript, I don’t understand about it.

I need to create the structure of the post, title, subtitles, text, image.

Hi @Edgard_Neto, from looking at your screenshot it seems the title field in your incoming data is an object with two properties raw and rendered. Now when concatenating this object with your existing article string, you’d end up with [object Object] as shown on your screenshot (which is the default representation of an object in JavaScript).

So instead of item.json.title you could try item.json.title.rendered to get the actual text.

The chapterText field I couldn’t see on your screenshot showing the incoming data. Does it perhaps have a different name or is maybe nested in another field? Perhaps you can share the full JSON data you are sending to your Code node for a closer look?

Hello, I’ll put the code here from JSON! @MutedJam

Could you help me structure the title, subtitles and text and images?

I can’t send the full JSON code!

This code I got from “Merge” I don’t know if this is the correct place.

    "title": "Chapter 1: Understanding {{$json.keywords}}",
    "prompt": "Today, we delve into the fascinating world of {{$json.keywords}} and explore its various aspects and implications."
    "title": "Chapter 2: {{$json.keywords}}: Past, Present, and Future",
    "prompt": "In this chapter, we take a journey through time to examine the evolution of {{$json.keywords}} from its origins to the present day, and delve into the potential future developments."
    "title": "Chapter 3: {{$json.keywords}} and Society",
    "prompt": "How does {{$json.keywords}} influence our society? In this chapter, we analyze the impact of {{$json.keywords}} on various aspects of human life, including economy, culture, and social interactions."
    "title": "Chapter 4: Ethical Considerations of {{$json.keywords}}",
    "prompt": "As with any technological advancement, there are ethical dilemmas associated with {{$json.keywords}}. This chapter explores the ethical considerations surrounding {{$json.keywords}} and the need for responsible development and use."
    "title": "Chapter 5: {{$json.keywords}} in Education and Research",
    "prompt": "The field of education and research has been significantly influenced by {{$json.keywords}}. In this chapter, we discuss how {{$json.keywords}} is shaping the landscape of learning and discovery."
    "title": "Chapter 6: Emerging Trends and Future Possibilities",
    "prompt": "As we conclude our exploration of {{$json.keywords}}, we speculate on the emerging trends and potential future possibilities that this field holds, igniting our imagination with the endless opportunities yet to come."


Hi @Edgard_Neto, so you’re saying your Merge node is values such as Chapter 2: {{$json.keywords}}: Past, Present, and Future lookoing like they contain an expression but without actually containing an expression? This seems most unusual and I am not quite sure what you are trying to achieve tbh.

How do you want to populate field such as image or subtitle1 based on this dataset?

1 Like

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