0

Client is recieving events from Kafka server as a string , is it possible to get Json object from string ? Like in below data i wanted to parse [object object] from string or i should ask data Source to send parsed object ?

ctrl.js

$scope.event = [];
$scope.event.push = data;

data

[2017-03-22T20:40:03Z]|zl75848|info|id: c37a6657-2f97-4955-8756-09d94beacdba|actor.CIS|ENTITYID_1:1490215203745:[object Object]

hussain
  • 6,587
  • 18
  • 79
  • 152
  • Is this what you are looking for: https://www.w3schools.com/js/js_json_parse.asp ? – Viliam Aboši Apr 10 '17 at 19:44
  • Possible duplicate of [Safely turning a JSON string into an object](http://stackoverflow.com/questions/45015/safely-turning-a-json-string-into-an-object) – Ryan Apr 10 '17 at 20:02
  • there might be case when object will be already parsed in event i think it will throw error on `JSON.parse` ? – hussain Apr 10 '17 at 20:27
  • a json object should contain key and value, the data you shared,I'm not sure if there is a key present for the values.. some of them might have it, but unclear – Searching Apr 10 '17 at 20:29

0 Answers0