我在PHP中使用json_decode解码以下数据时收到无效的json错误

时间:2019-03-06 11:45:36

标签: php

[{\\“ field_display_txt \\”:\\“新的自定义字段电话\\”,\\“ field_value \\”:0:0,{\\“ field_display_txt \\”:\\“新的自定义字段\\“,\\” field_value \\“:\\” test_zapier \\“},{\\” field_display_txt \\“:\\”新的自定义字段选择\\“,\\” field_value \\“:\ \“ 1 \\”}]

1 个答案:

答案 0 :(得分:0)

您需要使用\\删除$data = '[{\\"field_display_txt\\":\\"New custom field phone\\",\\"field_value\\":0},{\\"field_display_txt\\":\\"New custom field\\",\\"field_value\\":\\"test_zapier\\"},{\\"field_display_txt\\":\\"New custom field select\\",\\"field_value\\":\\"1\\"}]'; $json = json_decode(stripslashes($data), true); print_r($json); 然后解码

<?xml version="1.0" encoding="UTF-8"?>


<jive> 
  <adminConsole> 
    <port>9090</port>  
    <securePort>9091</securePort> 
  </adminConsole>  
  <locale>en</locale>  


  <jdbcProvider>
    <driver>oracle.jdbc.driver.OracleDriver</driver>
    <connectionString>jdbc:oracle:thin:@dfsdev.cpckubosallr.as-south-5.rds.amazonaws.com:1610:*****?user=*****&amp;password=*******</connectionString>
  </jdbcProvider>

  <provider>
    <auth>
      <className>org.jivesoftware.openfire.auth.JDBCAuthProvider</className>
    </auth>
  </provider>
  <jdbcAuthProvider>
     <passwordSQL>SELECT password FROM user_account WHERE username=?</passwordSQL>
     <passwordType>plain</passwordType>
   </jdbcAuthProvider>


  <connectionProvider> 
    <className>org.jivesoftware.database.DefaultConnectionProvider</className> 
  </connectionProvider>  
  <database> 
    <defaultProvider> 
      <driver>oracle.jdbc.driver.OracleDriver</driver>  
      <serverURL>jdbc:oracle:thin:@dfsdev.cpckubosallr.ap-south-1.rds.amazonaws.com:1610:dfsdev</serverURL>  
      <username encrypted="true">afa1610424fefa5245e51003d202323d05fca131295db961</username>  
      <password encrypted="true">af0a4b633bbf2e8b0c56659e7eeac1fc816af544d13ddb30c932220fbefdca6c413f2f312f6e38c7</password>  
      <testSQL>select 1 from dual</testSQL>  
      <testBeforeUse>false</testBeforeUse>  
      <testAfterUse>false</testAfterUse>  
      <testTimeout>500</testTimeout>  
      <timeBetweenEvictionRuns>30000</timeBetweenEvictionRuns>  
      <minIdleTime>900000</minIdleTime>  
      <maxWaitTime>500</maxWaitTime>  
      <minConnections>3</minConnections>  
      <maxConnections>3</maxConnections>  
      <connectionTimeout>1.0</connectionTimeout> 
    </defaultProvider> 
  </database>  
  <setup>true</setup> 
  <fqdn>www.localpocsales.spicelabs.in</fqdn>
</jive>

http://sandbox.onlinephpfunctions.com/code/a43301dddeb89aedca6a50eed703f935ac721496