1
2 '''
3 Created on 07-Jan-2013
4
5 @author: Raghav Kashyap(raghavkashyap@paxterrasolutions.com)
6
7 TestON is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 2 of the License, or
10 (at your option) any later version.
11
12 TestON is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17
18 You should have received a copy of the GNU General Public License
19 along with TestON. If not, see <http://www.gnu.org/licenses/>.
20
21
22 '''
23
24 import json
26 '''
27 Module that parses the response Json to Dictionary and Vice versa.
28 '''
31
33 '''
34 This will parse the json formatted string and return content as Dictionary
35 '''
36 response_dict = {}
37 try :
38 response_dict = json.loads(json_response)
39 except Exception:
40 main.log.error("Json Parser is unable to parse the string")
41 return response_dict
42
43 '''
44
45 def dict_json(self,response_dict):
46
47 # This will parse the Python Dictionary and return content as Json string.
48
49 json_response = {}
50 try :
51 json_response = json.dumps(response_dict)
52 except Exception:
53 main.log.error("Json Parser is unable to parse the string")
54 return json_response
55 '''
56