Is it possible to write data to JSON with Extjs4? - json

Is it possible to write data to JSON without php/asp, only ExtJS? Can someone provide simple example of how to do this (sending form data to Json)?

Where do you want to store your json data exactely ?
Since you don't want to use a server-side script to back it up, I presume it's client-side.
Then I'd say a combination of Ext.data.writer.Json + one of the following :
Ext.data.proxy.LocalStorage
Ext.data.proxy.Memory
Ext.data.proxy.SessionStorage

Related

Request for example server side generated JSON for HPP integration

I'm trying to use a full page redirect with a direct integration and if I'm reading the documentation correctly I believe I should be able to generate the server side JSON to pass into RealexHpp.redirect. I know the code to generate this JSON is shared in a number of languages, but is the raw JSON output shared anywhere? I ask as the language I'm writing in isn't one of the ones covered, so I'm trying to make sure I get the output format correct.
I've tried re-creating the JSON structure based on what I believe the Java code displayed should output, but I'm obviously doing something wrong as its not working, would be really useful if I had some raw JSON to compare it against to make sure I'm getting the structure right.
Many thanks,
Raw JSON examples are not available, but we do have HTML POST examples (https://developer.globalpay.com/hpp/card-payments). You can build a JSON based on these.
This is how the JSON should look like: {"MERCHANT_ID":"MerchantId","ACCOUNT":"internet","ORDER_ID":"N6qsk4kYRZihmPrTXWYS6g","AMOUNT":"1999","CURRENCY":"EUR","TIMESTAMP":"20221121100715","AUTO_SETTLE_FLAG":"1","SHIPPING_CODE":"50001|Apartment 825","SHIPPING_CO":"US","HPP_SHIPPING_STREET1":"Apartment 825","HPP_SHIPPING_STREET2":"Complex 741","HPP_SHIPPING_STREET3":"House 963","HPP_SHIPPING_CITY":"Chicago","HPP_SHIPPING_STATE":"IL","HPP_SHIPPING_POSTALCODE":"50001","HPP_SHIPPING_COUNTRY":"840","BILLING_CODE":"59|123","BILLING_CO":"GB","HPP_BILLING_STREET1":"Flat 123","HPP_BILLING_STREET2":"House 456","HPP_BILLING_STREET3":"Unit 4","HPP_BILLING_CITY":"Halifax","HPP_BILLING_POSTALCODE":"W5 9HR","HPP_BILLING_COUNTRY":"826","HPP_CUSTOMER_EMAIL":"james.mason#example.com","HPP_CUSTOMER_PHONENUMBER_MOBILE":"44|07123456789","HPP_PHONE":"44|07123456789","HPP_ADDRESS_MATCH_INDICATOR":"FALSE","HPP_VERSION":"2","SHA1HASH":"308bb8dfbbfcc67c28d602d988ab104c3b08d012"}

JSON - Validate Form Data

I used xml earlier and learning JSON now. To restrict the user to enter garbage values for form fields such as address etc, in XML we can define a complex object in schema file. But using JSON How can do that? JSON accepts any data from the user. Could any one please provide me ideas or an example code?
Thanks in Advance.
it is possible to do validation with schemas in JSON :
http://en.wikipedia.org/wiki/JSON#JSON_Schema
depending on what you need to validate :
http://json-schema.org/latest/json-schema-validation.html
Online tool for testing :
http://www.jsonschema.net/

Parse APEX RESTful WebService reference JSON response stored in CLOB001 column

I am trying to generate a report page in my APEX application, using the data obtained from a REST service response.
I added a new RESTful webservice reference and sepecified a JSON output.
Then I've generated a query/report page, but this is what's being currently displayed:
Instead I want the report to display the contents of data field on the JSON response (A single row with various columns and values)
Is there any straight forward way to show each response element and field on its row and column instead of a single column and row with the whole response, like there is with XML RESTful responses?
Consider whether another output type may be more handy. If you're putting out JSON and expect to handle it in PLSQL, then you do need to realize that PLSQL does not handle that natively.
Want to handle the rest response as json in plsql? Then look into some PLSQL libraries/projects that may do this:
http://reseau.erasme.org/pl-sql-library-for-JSON?lang=en
http://sourceforge.net/projects/pljson/
Then print out the returned HTML through HTP.P calls.
Though honestly, if you want to stick with plsql you would be much better off using XML as a return type, since you can then use all the xml goodies in the database. Though simply spitting out some html structure may not be quite too interesting (but I digress).
Or call the rest service through an ajax call from javascript, and handle the object there. After all, JSON is Javascript Object Notation and should be perfect for javascript, right? Then simply inject your html somewhere in the document. Ideally you would set up a region as a container for this.

Javascript in place of json input step

I am loading data from a mongodb collection to a mysql table through Kettle transformation.
First I extract them using MongodbInput and then I use json input step.
But since json input step has very low performance, I wanted to replace it with a
javacript script.
I am a beginner in Javascript and even though i tried somethings, the kettle javascript script is not recognizing any keywords.
can anyone give me sample code to convert Json data to different columns using javascript?
To solve your problem you need to see three aspects:
Reading from MongoDB
Reading from JSON
Reading from (probably) String
Reading from MongoDB Except if you changed the interface, MongoDB returns not JSON but BSON files (~binary JSON). You need to see the MongoDB documentation about reading and writing BSON: probably something like BSON.to() and BSON.from() but I don't know it by heart.
Reading from JSON Once you have your BSON in JSON format, you can read it using JSON.stringify() which returns a String.
Reading from (probably) String If you want to use the capabilities of JSON (why else would you use JSON?), you also want to use JSON.parse() which returns a JSON object.
My experience is that to send a JSON object from one step to the other, using a String is not a bad idea, i.e. at the end of a JavaScript step, you write your JSON object to a String and at the beginning of the next JavaScript step (can be further down the stream) you parse it back to JSON to work with it.
I hope this answers your question.
PS: writing JavaScript steps requires you to learn JavaScript. You don't have to be a master, but the basics are required. There is no way around it.
you could use the json input step to get the values of this json and put in common rows

POSTing data to a server with jQuery - why use JSON?

All over the net I see examples of using jQuery to make AJAX POSTs of JSON encoded data to a server. What is the point of encoding the data in JSONfirst? Why not just send it as the default data type application/x-www-url-form-encoded which would save having to parse JSON data on the server?
Couple of reasons. One, it's very easy to turn a JavaScript object into JSON, while it takes effort to encode it as x-www-url-form-encoded. Also, x-www-url-form-encoded isn't really used that much any more. Besides the couple of input types that require a form, most things use AJAX nowadays. Also, JSON is much easier to debug because it's legible.
First, you don't have to use json. If you are more comfortable using any other format, then use it.
But keep in mind, it's all strings. And sometimes it makes sense to use a format like JSON. What happens if you form is dynamic, and you enter multiple instances of the same thing (e.g. name1, name2, name3....)? It's really easy to iterate over such things with JSON. And JSON parsers are readily available for all platforms, so it's not like using it is a hinderance on any platforms. Plus, if both submissions and responses use the same format, there is the benefit of consistency for the data in requests and responses.
JSON is short for JavaScript Object Notation, and is a way to store information in an organized, easy-to-access manner.In a nutshell, it gives us a human-readable collection of data that we can access in a really logical manner.
We use JSON encoding to organize stored information.
Example:
var jason = {
"age" : "24",
"hometown" : "Missoula, MT",
"gender" : "male"
};
To access the information stored in json, we can simply refer to the name of the property we need.
Result:
document.write('Json is ' json.age); // Output: Jason is 24