help needed

nani ametumia angular 2 here , i want to know how to convert json complex object to a javascript object, nmetafuta stack overflow na forum zote sjapata answer fiti then someone referred me here ati kuna maguru

the json object am getting is an array of objects

array[
[ol]
[li]Communications:Object[/li][li]Economy:Object[/li][li]Energy:Object[/li][li]Geography:Object[/li][li]Government:Object[/li][li]Introduction:Object[/li][li]Military:Object[/li][li]People and Society:Object[/li][li]Transnational Issues:Object[/li][li]Transportation:Object][/li][/ol]

to convert to Json, use below sample

        var user_object = new Object();
      
        var sample_json_object = {
                    'uid' : 'sample_uid',
                    'pwd' : 'sample_pwd'
                };
        user_object= {
                'credentials' : angular.toJson(sample_json_object)
        };

to parse a serialized Json Object, use below sample

var result = angular.fromJson(serialized_json_object);

这是火箭科学 !

:D:D:D:D
very basic beginner stuff, on the other hand, mandarin is rocket science

1 Like