PList for JSON converter and client JSON response processing

Is there any tool that can convert my PLIST to JSON. I don't have a big idea on JSON formatting. I have a PLIST for which I want an equivalent JSON file.

Also, how we handle the JSON response on the iOS client using Object C. I have been working with the PList answer so far.

+4
source share
2 answers

Others previously asked about converting .plist files to json here .

Once you have the data in json format, you can use the Apple NSJSONSerialization class documented here :

You use the NSJSONSerialization class to convert JSON to Foundation objects and convert Foundation objects to JSON.

There are other libraries that you can use, although you will find some of them in the answers to this question .

+1
source

The best way to do this (on os x) is to use the command line tool, plutil.

It is used as follows:

 plutil -convert xml1 filenameToConvert -o outputFilename 

These are the options for "-convert": xml1, binary1, json. For this we will use json. For this command, you must be in the same directory as the plist file. For this test, we will convert test.plist (an xml file created by xcode in xml format) to json. It will create a file called test.json:

 plutil -convert json test.plist -o test.json 

to convert it back we would go:

 plutil -convert xml1 test.json -o test.plist 
+3
source

Source: https://habr.com/ru/post/1434083/


All Articles