I have a json data for segments like following: {"Segment_definitions":[{"segmentName":"S1","definition":{"a1":[19.0,25.0],"a2":["Seg2"]}},{"segmentName":"S2","definition":{"a4":[true,false],"a3":[4,6],"a1":[-1.0,21.0]}}]}
This is the deciding json data for categorisation.
Consumer examples -
{"a1":{"type":"Double","value":21.0},"a2":{"type":"string","value":"Seg1"},"a3":{"type":"Int","value":5},"a4":{"type":"Boolean":"value":false}}
{"a1":{"type":"Double","value":2.0},"a2":{"type":"string","value":"Seg2"},"a3":{"type":"Int","value":-1},"a4":{"type":"Boolean":"value":true}}
I need to categorise these 2 consumers into S1 or S2 segments. The code needs to be scalable to add further segments in the future. How do i do that using json arrays expicitly?
I have tried converting to dataframe and tried to compare row by row but the code was too tedious.