使用json_encode数据设置输入字段默认值

我正在尝试使用数据库中的内容为输入字段设置默认值,我已经成功地从数据库中获取了数据,但是对于如何设置从数据库中获取到文本字段的默认值感到困惑。 以下是我的php代码,可从数据库中获取数据:

function fetch_user_data() {  
global $wpdb;
$user_ID= get_current_user_id();   
$result = $wpdb->get_results ( "SELECT * FROM mydbtable WHERE user_id =  $user_ID "); 
foreach ( $result as $print ) {
 $data= $print->address;
echo json_encode($data);
}
}

输入字段如下所示:

<input field_type="text" name="myinputdield" id="myinputdield" value="" type="text" class="myinputdield">

I am trying to achieve it with jquery, but thats where i get lost, i know how to set the default fields manually but i will appreciate a guide on how to do it with the json_encode($data); manually i achieve it with this simple jquery code:

jQuery("#myinputdield").attr("value", "defaultvalue"); 

I would like the default value to be the json_encode($data);