-
Notifications
You must be signed in to change notification settings - Fork 27
/
JsonConverter.php
48 lines (44 loc) · 1.39 KB
/
JsonConverter.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/*
* This file is part of the webmozart/json package.
*
* (c) Bernhard Schussek <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Webmozart\Json\Conversion;
/**
* Converts data to and from JSON.
*
* @since 1.3
*
* @author Bernhard Schussek <[email protected]>
*/
interface JsonConverter
{
/**
* Converts an implementation-specific data structure to JSON.
*
* @param mixed $data The data to convert
* @param array $options Additional implementation-specific conversion options
*
* @return mixed The JSON data. Pass this data to a {@link JsonEncoder} to
* generate a JSON string
*
* @throws ConversionFailedException If the conversion fails
*/
public function toJson($data, array $options = array());
/**
* Converts JSON to an implementation-specific data structure.
*
* @param mixed $jsonData The JSON data. Use a {@link JsonDecoder} to
* convert a JSON string to this data structure
* @param array $options Additional implementation-specific conversion options
*
* @return mixed The converted data
*
* @throws ConversionFailedException If the conversion fails
*/
public function fromJson($jsonData, array $options = array());
}