Generate JSON from PHP classes

General discussions related to php

Moderators: macek, egami, gesf

rleitman
New php-forum User
New php-forum User
Posts: 7
Joined: Fri Oct 12, 2012 5:33 am

Generate JSON from PHP classes

Postby rleitman » Sat Oct 13, 2012 9:56 am

I have an old PHP site with arrays and classes, no ajax nor JSON. the PHP is embedded within the HTML. Any auto tool to generate JSON from the PHP classes so I can generate whole new html 5 pages whithout the need to embed php in them ?

jinijames
New php-forum User
New php-forum User
Posts: 20
Joined: Fri Oct 19, 2012 4:32 am
Location: India
Contact:

Re: Generate JSON from PHP classes

Postby jinijames » Mon Nov 05, 2012 4:32 am

class Error {
private $name;
private $code;
private $msg;
public function __construct($ErrorName, $ErrorCode, $ErrorMSG){
$this->name = $ErrorName;
$this->code = $ErrorCode;
$this->msg = $ErrorMSG;
}
public function getCode(){
return $this->code;
}
public function getName(){
return $this->name;
}
public function getMsg(){
return $this->msg;
}
public function toJSON(){
$json = "";

return json_encode($json);
}
}



hire php developer | hire magento developer


Return to “PHP General”

Who is online

Users browsing this forum: No registered users and 2 guests