Spring @ResponseBody Jackson JsonSerializer with JodaTime

Although you can put an annotation for each date field, is better to do a global configuration for your object mapper. If you use jackson you can configure your spring as follow: <bean id=”jacksonObjectMapper” class=”com.company.CustomObjectMapper” /> <bean id=”jacksonSerializationConfig” class=”org.codehaus.jackson.map.SerializationConfig” factory-bean=”jacksonObjectMapper” factory-method=”getSerializationConfig” > </bean> For CustomObjectMapper: public class CustomObjectMapper extends ObjectMapper { public CustomObjectMapper() { super(); … Read more

ASP.NET MVC 4 JSON Binding to the View Model – Nested object error

You can keep your existing ActionMethod untouched without the need of json serializing: In the client side create an object from your json: JSON.parse(jsonData) and send that in the $.ajax data property. Or, instead of creating json, create an object: var dataObject = new Object(); dataObject.Town = $(‘#txt-Town’).val(); dataObject.District = $(‘#txt-District’).val(); … And again, send … Read more

Handle JSON Object in XMLHttp response in Excel VBA Code

The code gets the data from nseindia site which comes as a JSON string in responseDiv element. Required References 3 Class Module i have used cJSONScript cStringBuilder JSON (I have picked these class modules from here) You may download the file from this link Standard Module Const URl As String = “http://www.nseindia.com/live_market/dynaContent/live_watch/get_quote/GetQuote.jsp?symbol=ICICIBANK” Sub xmlHttp() Dim … Read more

Post JSON to web in excel vba

JSON can be very sensitive to how it’s formatted, so I would make sure everything is quoted properly before it is sent. I would recommend splitting Body into a separate variable and debugging the value with http://jsonformatter.curiousconcept.com/ before sending. Dim Body As String Body = “{“”mType””:””OPEN_SYSTEM_TRADE””,””systemOwnerId””:10}” ‘ Set breakpoint here, get the Body value, and … Read more

Register/login user with WordPress JSON API

1.Paste Following code in your themes function.php file. 2.Make sure that WP-REST-API plugin Should be installed on wordpress site add_action( ‘rest_api_init’, ‘register_api_hooks’ ); function register_api_hooks() { register_rest_route( ‘custom-plugin’, ‘/login/’, array( ‘methods’ => ‘POST’, ‘callback’ => ‘login’, ) ); } function login($request){ $creds = array(); $creds[‘user_login’] = $request[“username”]; $creds[‘user_password’] = $request[“password”]; $creds[‘remember’] = true; $user = … Read more

node.js readfile error with utf8 encoded file on windows

Per “fs.readFileSync(filename, ‘utf8’) doesn’t strip BOM markers #1918”, fs.readFile is working as designed: BOM is not stripped from the header of the UTF-8 file, if it exists. It at the discretion of the developer to handle this. Possible workarounds: data = data.replace(/^\uFEFF/, ”); per https://github.com/joyent/node/issues/1918#issuecomment-2480359 Transform the incoming stream to remove the BOM header with … Read more