Giter Club home page Giter Club logo

Comments (2)

xlat avatar xlat commented on August 21, 2024

Hi,
01: not sure what you mean, is the method tojson() what you need?
02: you may use getattributes ( ref string as_names[] ) returns long to get list of attributes (the object "keys")
03: you have to write a visitor to build the xml yourself, there is not automatic way available at know, may be a feature request?

from pbjson.

prashantnirgun avatar prashantnirgun commented on August 21, 2024

Hey @xlat thanks resolved however my code is as follows just check once if there is any improvement let me know, My requirement was to only display the report and not edit or update so this is ok for me also my array size is also limited.

int li_start, li_end, li_col_start, li_col_count
String ls_error, ls_response, ls_value, ls_attributes[], ls_key, ls_row
any la_data, la_contents[]
json ln_json, ln_item

ln_json = create json
ls_response = '{"contents": [{"id" : "1", "name" : "one"},{ "id" : "2", "name" : "Two"}]}'
ls_error = ln_json.parse(ls_response)

if ls_error = "" then
	ln_json.retrieve("contents", ref la_data)
	la_contents[] = la_data
	li_end = upperbound( la_contents[] )
	//MessageBox("Info", "Name : " + string(ln_item.getattribute("name")))
	For li_start = 1 TO li_end
		ln_item = la_contents[li_start]
		ln_item.getattributes(ls_attributes)
		li_col_count = upperbound( ls_attributes )
		ls_row = ''
		For li_col_start = 1 TO li_col_count
			ls_key = ls_attributes[li_col_start]
			ls_value = String(ln_item.getattribute(ls_attributes[li_col_start] ))
			//MessageBox("Info", ls_key + " : " + ls_value)
			ls_row = ls_row + ls_value
			IF li_col_start < li_col_count THEN ls_row = ls_row + ','
		NEXT
		//Messagebox("row", ls_row)
		write_log("d:\tss\output\report.csv", ls_row)
	next
end if

destroy ln_json

from pbjson.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.