Data Ingestion and Replication
- Data Ingestion and Replication
- All Products
import json temp=json.loads(inputData) temp["name"]="Mr "+temp["name"] outputData=json.dumps(temp) ################################################################### inputData: { "name":"John", "age":30, "city":"New York"} outputData: { "name":"Mr John", "age":30, "city":"New York"}
temp = ''.join(str(chr(c)) for c in inputData) temp += " - this is edited again text" outputData = bytearray(temp, 'utf-8') ################################################################### inputData: Sample text outputData: Sample text - this is edited again text
import xml.etree.ElementTree as ET myroot = ET.fromstring(inputData) for x in myroot: if x.tag=="body": x.tag="Msg" xmlstr = ET.tostring(myroot) outputData=xmlstr.decode('utf-8') ################################################################### inputData: <note><to>You</to><from>Me</from><heading>Message</heading><body>Happy Coding</body></note> outputData: <note><to>You</to><from>Me</from><heading>Message</heading><Msg>Happy Coding</Msg></note>