The problem is that when sending JSON objects to Mongo or Json File

Emmanuel Magaña Medellin 40 Reputation points
2024-03-08T19:52:51.5466667+00:00

Hello everyone, I have an issue when trying to send data to MongoDB from a PostgreSQL database using a copy activity in Azure Data Factory. The problem is that when sending JSON objects to Mongo or Json File, they appear as if they were strings. I tried sending it first to a JSON file, but it's the same; it's detected as a string and not as a JSON object. I already changed the mapping to specify that it's JSON, but it's not working.

Captura de pantalla 2024-03-08 a la(s) 1.47.26 p.m.

Captura de pantalla 2024-03-08 a la(s) 1.50.23 p.m.

Captura de pantalla 2024-03-08 a la(s) 1.50.36 p.m.

Captura de pantalla 2024-03-08 a la(s) 1.50.45 p.m.

Captura de pantalla 2024-03-08 a la(s) 1.50.53 p.m.

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,624 questions
0 comments No comments
{count} votes

Accepted answer
  1. Amira Bedhiafi 33,071 Reputation points Volunteer Moderator
    2024-03-10T14:29:27.01+00:00

    First thing to think about it is to verify that the data being exported from PostgreSQL is in a valid JSON format. Sometimes, when data is extracted, it might be serialized as a string to ensure compatibility during the transfer. You may need to explicitly cast or convert it to a JSON format before or during the transfer process.

    Another detail in Azure Data Factory, when setting up the copy activity, ensure that you are correctly specifying the output format. If the data is being interpreted as a string, it's possible that the serialization settings or the sink's dataset definition in Data Factory needs adjustment.

    For MongoDB, make sure that the sink dataset is correctly configured to handle JSON as objects. MongoDB expects JSON-like structures (BSON), so ensure that your mapping or schema definition in Data Factory allows for this.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.