Uploaded image for project: 'Kafka Connector'
  1. Kafka Connector
  2. KAFKA-352

The data obtained through the connector is an un-parsable json string with " and \ and escape symbols, not the JSON string obtained by json.toString()

    XMLWordPrintableJSON

Details

    • Icon: Question Question
    • Resolution: Gone away
    • Icon: Major - P3 Major - P3
    • None
    • 1.9.1
    • None
    • None

    Description

      Original title: 通过连接器获取的数据,是带有“ and \ 和转义符号的无法解析的json字符串,而不是json.tostring()所获取的jsonString

      This is the description of the source connection:

      {"connector.class":"com.mongodb.kafka.connect.MongoSourceConnector",
       "mongo.errors.deadletterqueue.topic.name":"conn_error_data",
        "publish.full.document.only":"false", 
        " mongo.errors.log.enable":"true",
        "startup.mode":"copy_existing",
        "tasks.max":"2",
        "change.stream.full.document":"updateLookup",
        "collection" :"",
        "mongo.errors.tolerance":"all",
        "database":"****",
        "topic.prefix":"mongo-cdc1",
        "topic.separator":"_",
        " connection.uri":"mongodb://user:pass@mongo1:27017,mongo2:27017,mongo3:27017" ,
        “姓名”:"mongo-cdc-chatbot"}
      

      以下是获取的数据: (The following is the data obtained )

      “{\“_ID\”: {\"_data\": \"8263EA11F300000A002B022C0100296E5A10044626960F9B9E4F8A8CCB5B7FB645F88746645F6964006463E30D187FA0165B25002E010004\"}
      , \"operationType\": \"delete\", \"clusterTime\": \{\"$timestamp\": {\"t\": 1676284403, \"i\": 2560}}, \"ns\ ": \{\"db\": \"chatbot\", \"coll\": \"test\"}, \"documentKey\": {\"_id\":
      {\"$oid\": \"63e30d187fa0165b25002e01\"}}}"
      

      When parsing:

      通过BSONDocumeng.parse(str)解析是出现的错误:
       
      readStartDocument 只能在 CurrentBSONType 为 DOCUMENT 时调用,不能在 CurrentBSONType 为 STRING 时调用。
      

      Attachments

        Activity

          People

            ross@mongodb.com Ross Lawley
            liuxiaoyang904.61@gmail.com 晓阳 刘
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: