Method for casting string to an object (dict) or array. Note: String can be either serialized as JSON or a raw Python output.
(x)
| 26 | |
| 27 | |
| 28 | def _cast_object(x): |
| 29 | """ |
| 30 | Method for casting string to an object (dict) or array. |
| 31 | |
| 32 | Note: String can be either serialized as JSON or a raw Python output. |
| 33 | """ |
| 34 | x = _cast_none(x) |
| 35 | |
| 36 | if isinstance(x, six.string_types): |
| 37 | try: |
| 38 | return json_decode(x) |
| 39 | except: |
| 40 | return ast.literal_eval(x) |
| 41 | else: |
| 42 | return x |
| 43 | |
| 44 | |
| 45 | def _cast_boolean(x): |
nothing calls this directly
no test coverage detected