@@ -47,7 +47,7 @@ feature -- Post
4747			end 
4848		end 
4949
50- feature  --  	 Get
50+ feature  --  Get
5151
5252	get_from_id  (a_spreadsheet_id : STRING_ 8 ; a_params : detachable  EG_SPREADSHEET_PARAMETERS ): detachable  EG_SPREADSHEET 
5353		note 
@@ -299,17 +299,19 @@ feature {NONE} -- JSON To Eiffel
299299			--  Create an object `EG_COLOR` from a json rerpesentation `a_json`.
300300		do 
301301			create  Result 
302- 			if  attached  real_value_from_json  (a_json , " red"  ) as  l_val  then 
303- 				Result .set_red  (l_val )
304- 			end 
305- 			if  attached  real_value_from_json  (a_json , " green"  ) as  l_val  then 
306- 				Result .set_green  (l_val )
307- 			end 
308- 			if  attached  real_value_from_json  (a_json , " blue"  ) as  l_val  then 
309- 				Result .set_blue  (l_val )
310- 			end 
311- 			if  attached  real_value_from_json  (a_json , " alpha"  ) as  l_val  then 
312- 				Result .set_alpha  (l_val )
302+ 			if  not  a_json .is_empty  then 
303+ 				if  attached  color_value_from_json  (a_json , " red"  ) as  l_val  then 
304+ 					Result .set_red  (l_val )
305+ 				end 
306+ 				if  attached  color_value_from_json  (a_json , " green"  ) as  l_val  then 
307+ 					Result .set_green  (l_val )
308+ 				end 
309+ 				if  attached  color_value_from_json  (a_json , " blue"  ) as  l_val  then 
310+ 					Result .set_blue  (l_val )
311+ 				end 
312+ 				if  attached  color_value_from_json  (a_json , " alpha"  ) as  l_val  then 
313+ 					Result .set_alpha  (l_val )
314+ 				end 
313315			end 
314316		end 
315317
@@ -404,7 +406,9 @@ feature {NONE} -- JSON To Eiffel
404406				Result .set_properties  (sheet_properties  (l_properties ))
405407			end 
406408			if  attached  {JSON_ARRAY } json_value  (a_json , " data"  ) as  l_data  then 
407- 					--  TODO
409+ 					across  l_data  as  ic  loop 
410+ 						Result .force_data  (eg_data_grid  (ic .item ))
411+ 					end 
408412			end 
409413			if  attached  {JSON_ARRAY } json_value  (a_json , " merges"  ) as  l_merges  then 
410414					--  TODO
@@ -441,6 +445,41 @@ feature {NONE} -- JSON To Eiffel
441445			end 
442446		end 
443447
448+ 	eg_data_grid  (a_json : JSON_VALUE ): EG_GRID_DATA 
449+ 			--  Create an object `EG_GRID_DATA` from a json representation.
450+ 		do 
451+ 			create  Result 
452+ 			if  attached  integer_value_from_json  (a_json , " startRow"  ) as  l_val  then 
453+ 				Result .set_start_row  (l_val )
454+ 			end 
455+ 			if  attached  integer_value_from_json  (a_json , " startColumn"  ) as  l_val   then 
456+ 				Result .set_start_column  (l_val )
457+ 			end 
458+ 			if  attached  {JSON_ARRAY } json_value  (a_json , " rowData"  ) as  l_data   then 
459+ 				across  l_data  as  ic  loop 
460+ 					Result .force_row_data  (eg_row_data  (ic .item ))
461+ 				end 
462+ 			end 
463+ 		end 
464+ 
465+ 	eg_row_data  (a_json : JSON_VALUE ): EG_ROW_DATA 
466+ 			--  Create an object `EG_ROW_DATA` from a json representation.
467+ 		do 
468+ 			create  Result 
469+ 			if  attached  {JSON_ARRAY } json_value  (a_json , " values"  ) as  l_data   then 
470+ 				across  l_data  as  ic  loop 
471+ 					Result .force_value (eg_cell_data  (ic .item ))
472+ 				end 
473+ 			end 
474+ 		end 
475+ 
476+ 	eg_cell_data  (a_json : JSON_VALUE ): EG_CELL_DATA 
477+ 			--  Create an object `EG_CELL_DATA` from a json representation.
478+ 		do 
479+ 			create  Result 
480+ 			
481+ 		end 
482+ 
444483	eg_named_ranges  (a_json : JSON_VALUE ): EG_NAMED_RANGE 
445484			--  Create an object `EG_NAMED_RANGE` from a json representation.
446485		do 
@@ -458,6 +497,9 @@ feature {NONE} -- JSON To Eiffel
458497
459498	sheet_properties  (a_json : JSON_VALUE ): EG_SHEET_PROPERTIES 
460499			--  Create an object `EG_SHEET_PROPERTIES` from a json representation `a_json`.
500+ 		local 
501+ 			l_stype : EG_SHEET_TYPE 
502+ 			l_grid_prop : EG_GRID_PROPERTIES 
461503		do 
462504			create  Result 
463505			if  attached  integer_value_from_json  (a_json , " sheetId"  ) as  l_sheetId  then 
@@ -470,19 +512,23 @@ feature {NONE} -- JSON To Eiffel
470512				Result .set_index  (l_index )
471513			end 
472514			if  attached  string_value_from_json  (a_json , " sheetType"  ) as  l_sheet_type  then 
515+ 				create  l_stype 
473516				if  l_sheet_type .is_case_insensitive_equal  (" GRID"  ) then 
474- 					Result . sheet_type .set_grid 
517+ 					l_stype .set_grid 
475518				elseif  l_sheet_type .is_case_insensitive_equal  (" OBJECT"  ) then 
476- 					Result . sheet_type .set_grid 
519+ 					l_stype .set_grid 
477520				end 
521+ 				Result .set_sheet_type  (l_stype )
478522			end 
479523			if  attached  {JSON_OBJECT } json_value  (a_json , " gridProperties"  ) as  l_grid_properties  then 
524+ 				create  l_grid_prop 
480525				if  attached  integer_value_from_json  (l_grid_properties , " rowCount"  ) as  l_row_count  then 
481- 					Result . grid_properties .set_row_count  (l_row_count )
526+ 					l_grid_prop .set_row_count  (l_row_count )
482527				end 
483528				if  attached  integer_value_from_json  (l_grid_properties , " columnCount"  ) as  l_column_count  then 
484- 					Result . grid_properties .set_column_count  (l_column_count )
529+ 					l_grid_prop .set_column_count  (l_column_count )
485530				end 
531+ 				Result .set_grid_properties  (l_grid_prop )
486532			end 
487533			if  attached  boolean_value_from_json  (a_json , " hidden"  ) as  l_hidden  then 
488534				Result .set_hidden  (l_hidden )
@@ -638,6 +684,21 @@ feature {NONE} -- Implementation
638684			end 
639685		end 
640686
687+ 	color_value_from_json  (a_json_data : detachable  JSON_VALUE ; a_id : STRING ): REAL 
688+ 		do 
689+ 			if 
690+ 				attached  {JSON_NUMBER } json_value  (a_json_data , a_id ) as  v  and  then 
691+ 				v .numeric_type  = v .real_type 
692+ 			then 
693+ 				Result  := v .item .to_real 
694+ 			elseif  attached  {JSON_NUMBER } json_value  (a_json_data , a_id ) as  v  and  then 
695+ 				v .numeric_type  = v .integer_type 
696+ 			then 
697+ 				Result  := v .item .to_integer 
698+ 			end 
699+ 
700+ 		end 
701+ 
641702	integer_value_from_json  (a_json_data : detachable  JSON_VALUE ; a_id : STRING ): INTEGER 
642703		do 
643704			if 
0 commit comments